[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog extensions/dejagnu/dejagnu.cpp ...
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] gnash ChangeLog extensions/dejagnu/dejagnu.cpp ... |
Date: |
Mon, 19 Mar 2007 17:11:16 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Bastiaan Jacques <bjacques> 07/03/19 17:11:15
Modified files:
. : ChangeLog
extensions/dejagnu: dejagnu.cpp
extensions/fileio: fileio.cpp
extensions/gtk2: gtkext.cpp
extensions/mysql: mysql_db.cpp mysql_table.cpp
libamf : amf.cpp
server : GetterSetter.cpp GetterSetter.h Property.h
PropertyList.cpp array.cpp array.h
as_environment.cpp as_function.cpp
as_function.h as_object.cpp as_object.h
as_value.h builtin_function.h
button_character_instance.cpp
button_character_instance.h character.cpp
character.h edit_text_character.cpp shm.cpp
shm.h sprite_instance.cpp swf_function.cpp
swf_function.h textformat.cpp textformat.h
timers.cpp timers.h video_stream_instance.cpp
server/asobj : Boolean.cpp Camera.cpp Color.cpp
ContextMenu.cpp CustomActions.cpp Date.cpp
Error.cpp Global.cpp Key.cpp Key.h LoadVars.cpp
LocalConnection.cpp LocalConnection.h Math.cpp
Microphone.cpp Mouse.cpp MovieClipLoader.cpp
NetConnection.cpp NetStream.cpp Number.cpp
Object.cpp Selection.cpp SharedObject.cpp
Sound.cpp Stage.cpp System.cpp System.h
TextSnapshot.cpp Video.cpp gen-asclass.sh
string.cpp xml.cpp xml.h xmlnode.cpp
xmlsocket.cpp xmlsocket.h
server/vm : ASHandlers.cpp action.cpp fn_call.h
testsuite/server: GetterSetterTest.cpp
Log message:
* server/vm/fn_call.h: Remove fn_call::result. Instead, all
methods and
functions called by ActionScript must return as_value. Thanks
to Ann
for the suggestion and for help with regular expressions.
* all over the place: Switch all ActionScript-called methods
over to
return as_value. Adjust all related methods. Also make
fn_call::nargs
unsigned.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2627&r2=1.2628
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/dejagnu/dejagnu.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/fileio/fileio.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/gtk2/gtkext.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/mysql/mysql_db.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/extensions/mysql/mysql_table.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/libamf/amf.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/GetterSetter.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/GetterSetter.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Property.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/PropertyList.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.cpp?cvsroot=gnash&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.h?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_function.cpp?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_function.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/server/builtin_function.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.h?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shm.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shm.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.196&r2=1.197
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.h?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/textformat.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/textformat.h?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.h?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/video_stream_instance.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Boolean.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Camera.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Color.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ContextMenu.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/CustomActions.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Date.cpp?cvsroot=gnash&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Error.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Key.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Key.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LoadVars.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LocalConnection.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/LocalConnection.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Math.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Microphone.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Mouse.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/MovieClipLoader.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetConnection.cpp?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.cpp?cvsroot=gnash&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Number.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Object.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Selection.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SharedObject.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Sound.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/System.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/System.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/TextSnapshot.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Video.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/gen-asclass.sh?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/string.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlnode.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlsocket.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlsocket.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/action.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/fn_call.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/GetterSetterTest.cpp?cvsroot=gnash&r1=1.7&r2=1.8
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2627
retrieving revision 1.2628
diff -u -b -r1.2627 -r1.2628
--- ChangeLog 19 Mar 2007 14:50:33 -0000 1.2627
+++ ChangeLog 19 Mar 2007 17:11:13 -0000 1.2628
@@ -1,4 +1,14 @@
+2007-03-19 Bastiaan Jacques <address@hidden>
+
+ * server/vm/fn_call.h: Remove fn_call::result. Instead, all methods and
+ functions called by ActionScript must return as_value. Thanks to Ann
+ for the suggestion and for help with regular expressions.
+ * all over the place: Switch all ActionScript-called methods over to
+ return as_value. Adjust all related methods. Also make fn_call::nargs
+ unsigned.
+
2007-03-19 Ann Barcomb <address@hidden>
+
* doc/C/actionscript.xml, doc/C/actionscript/*, doc/C/Makefile.am:
Split main.xml into multiple files.
@@ -18,8 +28,8 @@
2007-03-19 Bastiaan Jacques <address@hidden>
- * testsuite/misc-ming.all/ming_utils.h: Add Ming defines available only
in
- CVS; some of the new testcases depend on these.
+ * testsuite/misc-ming.all/ming_utils.h: Add Ming defines available onl
+ in CVS; some of the new testcases depend on these.
2007-03-19 Sandro Santilli <address@hidden>
Index: extensions/dejagnu/dejagnu.cpp
===================================================================
RCS file: /sources/gnash/gnash/extensions/dejagnu/dejagnu.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- extensions/dejagnu/dejagnu.cpp 9 Mar 2007 18:20:41 -0000 1.5
+++ extensions/dejagnu/dejagnu.cpp 19 Mar 2007 17:11:14 -0000 1.6
@@ -32,9 +32,9 @@
namespace gnash
{
-void dejagnu_pass(const fn_call& fn);
-void dejagnu_fail(const fn_call& fn);
-void dejagnu_totals(const fn_call& fn);
+as_value dejagnu_pass(const fn_call& fn);
+as_value dejagnu_fail(const fn_call& fn);
+as_value dejagnu_totals(const fn_call& fn);
LogFile& dbglogfile = LogFile::getDefaultInstance();
@@ -65,14 +65,14 @@
return o.get();
}
-static void
+static as_value
dejagnu_ctor(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
dejagnu_as_object* obj = new dejagnu_as_object();
attachInterface(obj);
- fn.result->set_as_object(obj); // will keep alive
+ return as_value(obj); // will keep alive
// printf ("Hello World from %s !!!\n", __PRETTY_FUNCTION__);
}
@@ -108,7 +108,7 @@
return NULL;
}
-void
+as_value
dejagnu_pass(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -117,11 +117,11 @@
if (fn.nargs > 0) {
const char *text =
fn.env->bottom(fn.first_arg_bottom_index).to_string();
- fn.result->set_string(ptr->obj.pass(text));
+ return as_value(ptr->obj.pass(text));
}
}
-void
+as_value
dejagnu_fail(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -130,11 +130,11 @@
if (fn.nargs > 0) {
const char *text =
fn.env->bottom(fn.first_arg_bottom_index).to_string();
- fn.result->set_string(ptr->obj.fail(text));
+ return as_value(ptr->obj.fail(text));
}
}
-void
+as_value
dejagnu_totals(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -142,7 +142,7 @@
assert(ptr);
ptr->obj.totals();
- fn.result->set_bool(true);
+ return as_value(true);
}
Index: extensions/fileio/fileio.cpp
===================================================================
RCS file: /sources/gnash/gnash/extensions/fileio/fileio.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- extensions/fileio/fileio.cpp 9 Mar 2007 18:20:41 -0000 1.8
+++ extensions/fileio/fileio.cpp 19 Mar 2007 17:11:14 -0000 1.9
@@ -42,22 +42,22 @@
static const int BUFSIZE = 1024;
-void fileio_fopen(const fn_call& fn);
-void fileio_fread(const fn_call& fn);
-void fileio_fgetc(const fn_call& fn);
-void fileio_fgets(const fn_call& fn);
-void fileio_gets(const fn_call& fn);
-void fileio_fwrite(const fn_call& fn);
-void fileio_fputc(const fn_call& fn);
-void fileio_fputs(const fn_call& fn);
-void fileio_puts(const fn_call& fn);
-void fileio_fclose(const fn_call& fn);
-void fileio_getchar(const fn_call& fn);
-void fileio_putchar(const fn_call& fn);
-void fileio_fflush(const fn_call& fn);
-void fileio_ftell(const fn_call& fn);
-void fileio_fseek(const fn_call& fn);
-void fileio_unlink(const fn_call& fn);
+as_value fileio_fopen(const fn_call& fn);
+as_value fileio_fread(const fn_call& fn);
+as_value fileio_fgetc(const fn_call& fn);
+as_value fileio_fgets(const fn_call& fn);
+as_value fileio_gets(const fn_call& fn);
+as_value fileio_fwrite(const fn_call& fn);
+as_value fileio_fputc(const fn_call& fn);
+as_value fileio_fputs(const fn_call& fn);
+as_value fileio_puts(const fn_call& fn);
+as_value fileio_fclose(const fn_call& fn);
+as_value fileio_getchar(const fn_call& fn);
+as_value fileio_putchar(const fn_call& fn);
+as_value fileio_fflush(const fn_call& fn);
+as_value fileio_ftell(const fn_call& fn);
+as_value fileio_fseek(const fn_call& fn);
+as_value fileio_unlink(const fn_call& fn);
// <Udo> I needed a scandir() function and implemented it here for simplicity.
// Maybe this should be moved to a dedicated extension and a different class?
@@ -65,7 +65,7 @@
// applicable in ActionScript.
// Same applies for unlink(). Maybe a class FileOP or sim. would be
// appriopriate.
-void fileio_scandir(const fn_call& fn);
+as_value fileio_scandir(const fn_call& fn);
LogFile& dbglogfile = LogFile::getDefaultInstance();
@@ -108,14 +108,14 @@
return o.get();
}
-static void
+static as_value
fileio_ctor(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio * obj = new Fileio();
attachInterface(obj);
- fn.result->set_as_object(obj); // will keep alive
+ return as_value(obj); // will keep alive
}
@@ -313,7 +313,7 @@
result->set_as_object(array);
}
-void
+as_value
fileio_fopen(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -323,21 +323,21 @@
if (fn.nargs > 0) {
string filespec = fn.env->bottom(fn.first_arg_bottom_index).to_string();
string mode = fn.env->bottom(fn.first_arg_bottom_index-1).to_string();
- fn.result->set_bool(ptr->fopen(filespec, mode));
+ return as_value(ptr->fopen(filespec, mode));
}
}
-void
+as_value
fileio_fclose(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio *ptr = (Fileio *)fn.this_ptr;
assert(ptr);
- fn.result->set_bool(ptr->fclose());
+ return as_value(ptr->fclose());
}
-void
+as_value
fileio_fread(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -348,12 +348,12 @@
int count = ptr->fread(str);
if (count<0)
- fn.result->set_bool(false);
+ return as_value(false);
else
- fn.result->set_string(str.c_str());
+ return as_value(str.c_str());
}
-void
+as_value
fileio_fgetc(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -361,10 +361,10 @@
assert(ptr);
int i = ptr->fgetc();
char *c = reinterpret_cast<char *>(&i);
- fn.result->set_string(c);
+ return as_value(c);
}
-void
+as_value
fileio_fgets(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -372,10 +372,10 @@
assert(ptr);
string str;
str = ptr->fgets(str);
- fn.result->set_string(str.c_str());
+ return as_value(str.c_str());
}
-void
+as_value
fileio_gets(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -384,11 +384,11 @@
char buf[BUFSIZE];
memset(buf, 0, BUFSIZE);
string str = ::gets(buf);
- fn.result->set_string(buf);
+ return as_value(buf);
}
// Read a single character from standard in
-void
+as_value
fileio_getchar(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -396,98 +396,98 @@
assert(ptr);
int i = ::getchar();
char *c = reinterpret_cast<char *>(&i);
- fn.result->set_string(c);
+ return as_value(c);
}
-void
+as_value
fileio_fwrite(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio *ptr = (Fileio*)fn.this_ptr;
assert(ptr);
string str = fn.env->bottom(fn.first_arg_bottom_index).to_string();
- fn.result->set_int(ptr->fputs(str));
+ return as_value(ptr->fputs(str));
}
-void
+as_value
fileio_fputc(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio *ptr = (Fileio*)fn.this_ptr;
assert(ptr);
int c = (int) fn.env->bottom(fn.first_arg_bottom_index).to_number();
- fn.result->set_bool(ptr->fputc(c));
+ return as_value(ptr->fputc(c));
}
-void
+as_value
fileio_fputs(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio *ptr = (Fileio*)fn.this_ptr;
assert(ptr);
string str = fn.env->bottom(fn.first_arg_bottom_index).to_string();
- fn.result->set_bool(ptr->fputs(str));
+ return as_value(ptr->fputs(str));
}
// print to standard put
-void
+as_value
fileio_puts(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
string str = fn.env->bottom(fn.first_arg_bottom_index).to_string();
- fn.result->set_int(::puts(str.c_str()));
+ return as_value(::puts(str.c_str()));
}
-void
+as_value
fileio_putchar(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio *ptr = (Fileio*)fn.this_ptr;
assert(ptr);
string x = fn.env->bottom(fn.first_arg_bottom_index).to_string();
- fn.result->set_int(::putchar(x[0]));
+ return as_value(::putchar(x[0]));
}
-void
+as_value
fileio_fflush(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio *ptr = (Fileio*)fn.this_ptr;
assert(ptr);
- fn.result->set_int(ptr->fflush());
+ return as_value(ptr->fflush());
}
-void
+as_value
fileio_fseek(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio *ptr = (Fileio*)fn.this_ptr;
assert(ptr);
long c = (long) fn.env->bottom(fn.first_arg_bottom_index).to_number();
- fn.result->set_int(ptr->fseek(c));
+ return as_value(ptr->fseek(c));
}
-void
+as_value
fileio_ftell(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio *ptr = (Fileio*)fn.this_ptr;
assert(ptr);
int i = ptr->ftell();
- fn.result->set_int(i);
+ return as_value(i);
}
-void
+as_value
fileio_unlink(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Fileio *ptr = (Fileio*)fn.this_ptr;
assert(ptr);
string str = fn.env->bottom(fn.first_arg_bottom_index).to_string();
- fn.result->set_bool(ptr->unlink(str));
+ return as_value(ptr->unlink(str));
}
-void
+as_value
fileio_scandir(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
Index: extensions/gtk2/gtkext.cpp
===================================================================
RCS file: /sources/gnash/gnash/extensions/gtk2/gtkext.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- extensions/gtk2/gtkext.cpp 15 Feb 2007 20:11:23 -0000 1.1
+++ extensions/gtk2/gtkext.cpp 19 Mar 2007 17:11:14 -0000 1.2
@@ -49,14 +49,14 @@
#endif
// prototypes for the callbacks required by Gnash
-void gtkext_window_new(const fn_call& fn);
-void gtkext_signal_connect(const fn_call& fn);
-void gtkext_container_set_border_width(const fn_call& fn);
-void gtkext_button_new_with_label(const fn_call& fn);
-void gtkext_signal_connect_swapped(const fn_call& fn);
-void gtkext_container_add(const fn_call& fn);
-void gtkext_widget_show(const fn_call& fn);
-void gtkext_main(const fn_call& fn);
+as_value gtkext_window_new(const fn_call& fn);
+as_value gtkext_signal_connect(const fn_call& fn);
+as_value gtkext_container_set_border_width(const fn_call& fn);
+as_value gtkext_button_new_with_label(const fn_call& fn);
+as_value gtkext_signal_connect_swapped(const fn_call& fn);
+as_value gtkext_container_add(const fn_call& fn);
+as_value gtkext_widget_show(const fn_call& fn);
+as_value gtkext_main(const fn_call& fn);
// Sigh... We can't store the callbacks for the events in the GtkExt
// class object because that data is inaccessible to a C symbol based
@@ -136,14 +136,14 @@
return o.get();
}
-static void
+static as_value
gtkext_ctor(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
GtkExt *obj = new GtkExt();
attachInterface(obj);
- fn.result->set_as_object(obj); // will keep alive
+ return as_value(obj); // will keep alive
}
@@ -199,7 +199,7 @@
}
// this callback takes no arguments
-void gtkext_window_new(const fn_call& fn)
+as_value gtkext_window_new(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
GtkExt *ptr = dynamic_cast<GtkExt *>(fn.this_ptr);
@@ -207,12 +207,12 @@
GtkExt *obj = new GtkExt;
obj->window_new();
- fn.result->set_as_object(obj);
+ return as_value(obj);
}
// this callback takes 4 arguments, we only need two of them
// g_signal_connect (instance, detailed_signal, c_handler, data)
-void gtkext_signal_connect(const fn_call& fn)
+as_value gtkext_signal_connect(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
GtkExt *ptr = dynamic_cast<GtkExt *>(fn.this_ptr);
@@ -230,11 +230,12 @@
g_signal_connect (G_OBJECT (window->getWindow()), name.c_str(),
G_CALLBACK (generic_callback), (void *)name.c_str());
}
+ return as_value();
}
// this callback takes 2 arguments
// void gtk_container_set_border_width (GtkContainer *container, guint
border_width);
-void gtkext_container_set_border_width(const fn_call& fn)
+as_value gtkext_container_set_border_width(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -247,11 +248,12 @@
window->container_set_border_width(width);
dbglogfile << "set container border width to " << width << " !" << endl;
}
+ return as_value();
}
// Creates a new button with the label "Hello World".
// GtkWidget *gtk_button_new_with_label (const gchar *label);
-void gtkext_button_new_with_label(const fn_call& fn)
+as_value gtkext_button_new_with_label(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
GtkExt *ptr = dynamic_cast<GtkExt *>(fn.this_ptr);
@@ -261,8 +263,9 @@
const char *label = fn.arg(0).to_string();
GtkExt *obj = new GtkExt;
obj->button_new_with_label(label);
- fn.result->set_as_object(obj);
+ return as_value(obj);
}
+ return as_value();
}
// g_signal_connect_swapped(instance, detailed_signal, c_handler, data)
@@ -275,7 +278,7 @@
// c_handler : the GCallback to connect.
// data : data to pass to c_handler calls.
// Returns : the handler id
-void gtkext_signal_connect_swapped(const fn_call& fn)
+as_value gtkext_signal_connect_swapped(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
GtkExt *ptr = dynamic_cast<GtkExt *>(fn.this_ptr);
@@ -293,10 +296,11 @@
G_CALLBACK (gtk_widget_destroy),
G_OBJECT (parent->getWindow()));
}
+ return as_value();
}
// this takes two arguments
-void gtkext_container_add(const fn_call& fn)
+as_value gtkext_container_add(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
GtkExt *ptr = dynamic_cast<GtkExt *>(fn.this_ptr);
@@ -306,11 +310,12 @@
GtkExt *parent = dynamic_cast<GtkExt *>(fn.arg(0).to_object());
GtkExt *child = dynamic_cast<GtkExt *>(fn.arg(1).to_object());
gtk_container_add (GTK_CONTAINER (parent->getWindow()),
child->getWindow());
- fn.result->set_bool(true);
+ return as_value(true);
}
+ return as_value(false);
}
-void gtkext_widget_show(const fn_call& fn)
+as_value gtkext_widget_show(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
GtkExt *ptr = dynamic_cast<GtkExt *>(fn.this_ptr);
@@ -320,16 +325,18 @@
GtkExt *window = dynamic_cast<GtkExt *>(fn.arg(0).to_object());
gtk_widget_show(window->getWindow());
}
+ return as_value();
}
// gtk_main taks no arguments.
-void gtkext_main(const fn_call& fn)
+as_value gtkext_main(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
GtkExt *ptr = dynamic_cast<GtkExt *>(fn.this_ptr);
assert(ptr);
gtk_main();
+ return as_value();
}
std::auto_ptr<as_object>
Index: extensions/mysql/mysql_db.cpp
===================================================================
RCS file: /sources/gnash/gnash/extensions/mysql/mysql_db.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- extensions/mysql/mysql_db.cpp 17 Dec 2006 20:24:58 -0000 1.5
+++ extensions/mysql/mysql_db.cpp 19 Mar 2007 17:11:14 -0000 1.6
@@ -33,16 +33,16 @@
namespace gnash
{
-void mysql_connect(const fn_call& fn);
-void mysql_qetData(const fn_call& fn);
-void mysql_disconnect(const fn_call& fn);
-
-void mysql_query(const fn_call& fn);
-void mysql_row(const fn_call& fn);
-void mysql_fields(const fn_call& fn);
-void mysql_fetch(const fn_call& fn);
-void mysql_store(const fn_call& fn);
-void mysql_free(const fn_call& fn);
+as_value mysql_connect(const fn_call& fn);
+as_value mysql_qetData(const fn_call& fn);
+as_value mysql_disconnect(const fn_call& fn);
+
+as_value mysql_query(const fn_call& fn);
+as_value mysql_row(const fn_call& fn);
+as_value mysql_fields(const fn_call& fn);
+as_value mysql_fetch(const fn_call& fn);
+as_value mysql_store(const fn_call& fn);
+as_value mysql_free(const fn_call& fn);
LogFile& dbglogfile = LogFile::getDefaultInstance();
@@ -79,7 +79,7 @@
return o.get();
}
-static void
+static as_value
mysql_ctor(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -87,7 +87,7 @@
mysql_as_object* obj = new mysql_as_object();
attachInterface(obj);
- fn.result->set_as_object(obj); // will keep alive
+ return as_value(obj); // will keep alive
// printf ("Hello World from %s !!!\n", __PRETTY_FUNCTION__);
}
@@ -293,7 +293,7 @@
// Entry points for ActionScript methods
-void
+as_value
mysql_connect(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -306,13 +306,13 @@
const char *db =
fn.env->bottom(fn.first_arg_bottom_index-1).to_string();
const char *user =
fn.env->bottom(fn.first_arg_bottom_index-2).to_string();
const char *passwd =
fn.env->bottom(fn.first_arg_bottom_index-3).to_string();
- fn.result->set_bool(ptr->obj.connect(host, db, user, passwd));
+ return as_value(ptr->obj.connect(host, db, user, passwd));
} else {
- fn.result->set_bool(false);
+ return as_value(false);
}
}
-void
+as_value
mysql_qetData(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -325,7 +325,10 @@
as_array_object *arr = (as_array_object
*)fn.env->bottom(fn.first_arg_bottom_index-1).to_object();
// std::vector< std::vector<const char *> >
MySQL::query_t qresult;
- fn.result->set_bool(ptr->obj.getData(sql, qresult));
+#if 0
+ // This clearly makes no sense...
+ return as_value(ptr->obj.getData(sql, qresult));
+#endif
for (size_t i=0; i<qresult.size(); i++) {
vector<const char *> row;
row = qresult[i];
@@ -335,32 +338,32 @@
arr->push(entry);
}
}
- fn.result->set_bool(true);
+ return as_value(true);
// } else {
-// fn.result->set_bool(false);
+// return as_value(false);
}
}
-void
+as_value
mysql_free(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
mysql_as_object *ptr = (mysql_as_object*)fn.this_ptr;
assert(ptr);
ptr->obj.free_result();
- fn.result->set_bool(true);
+ return as_value(true);
}
-void
+as_value
mysql_fields(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
mysql_as_object *ptr = (mysql_as_object*)fn.this_ptr;
assert(ptr);
- fn.result->set_int(ptr->obj.num_fields());
+ return as_value(ptr->obj.num_fields());
}
-void
+as_value
mysql_fetch(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -371,20 +374,20 @@
as_value aaa = *res;
as_array_object *arr = new as_array_object;
arr->push(aaa);
- fn.result->set_as_object(arr);
+ return as_value(arr);
}
}
-void
+as_value
mysql_store(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
mysql_as_object *ptr = (mysql_as_object*)fn.this_ptr;
assert(ptr);
- fn.result->set_bool(ptr->obj.store_result());
+ return as_value(ptr->obj.store_result());
}
-void
+as_value
mysql_query(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -392,18 +395,18 @@
if (fn.nargs > 0) {
const char *sql = fn.env->bottom(fn.first_arg_bottom_index).to_string();
assert(ptr);
- fn.result->set_int(ptr->obj.guery(sql));
+ return as_value(ptr->obj.guery(sql));
}
}
-void
+as_value
mysql_disconnect(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
mysql_as_object *ptr = (mysql_as_object*)fn.this_ptr;
assert(ptr);
- fn.result->set_bool(ptr->obj.disconnect());
+ return as_value(ptr->obj.disconnect());
}
extern "C" {
Index: extensions/mysql/mysql_table.cpp
===================================================================
RCS file: /sources/gnash/gnash/extensions/mysql/mysql_table.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- extensions/mysql/mysql_table.cpp 18 Jan 2007 22:53:21 -0000 1.3
+++ extensions/mysql/mysql_table.cpp 19 Mar 2007 17:11:14 -0000 1.4
@@ -24,11 +24,11 @@
{
using namespace gnash;
- void size_method(const fn_call& fn)
+ as_value size_method(const fn_call& fn)
{
assert(fn.this_ptr); assert(fn.env);
table* tbl = (table*) (as_object*) fn.this_ptr;
- *fn.result = tbl->size();
+ return as_value(tbl->size());
}
table::table(MYSQL_RES* result)
Index: libamf/amf.cpp
===================================================================
RCS file: /sources/gnash/gnash/libamf/amf.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- libamf/amf.cpp 17 Mar 2007 05:21:33 -0000 1.27
+++ libamf/amf.cpp 19 Mar 2007 17:11:14 -0000 1.28
@@ -16,7 +16,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: amf.cpp,v 1.27 2007/03/17 05:21:33 rsavoye Exp $ */
+/* $Id: amf.cpp,v 1.28 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -739,6 +739,7 @@
AMF::encodeVariable(amf_element_t & /* el */)
{
GNASH_REPORT_FUNCTION;
+ return NULL;
}
void *
Index: server/GetterSetter.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/GetterSetter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/GetterSetter.cpp 4 Feb 2007 00:53:19 -0000 1.4
+++ server/GetterSetter.cpp 19 Mar 2007 17:11:14 -0000 1.5
@@ -34,13 +34,13 @@
namespace gnash {
-void
-GetterSetter::getValue(as_object* this_ptr, as_value& ret) const
+as_value
+GetterSetter::getValue(as_object* this_ptr) const
{
as_environment env;
- fn_call fn(&ret, this_ptr, &env, 0, 0);
+ fn_call fn(this_ptr, &env, 0, 0);
// TODO: need as_function::operator to be const..
- (*const_cast<as_function*>(_getter))(fn);
+ return (*const_cast<as_function*>(_getter))(fn);
}
void
@@ -48,7 +48,7 @@
{
as_environment env;
env.push(val);
- fn_call fn(NULL, this_ptr, &env, 1, 0);
+ fn_call fn(this_ptr, &env, 1, 0);
// TODO: need as_function::operator to be const..
(*const_cast<as_function*>(_setter))(fn);
}
Index: server/GetterSetter.h
===================================================================
RCS file: /sources/gnash/gnash/server/GetterSetter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/GetterSetter.h 4 Feb 2007 00:53:19 -0000 1.4
+++ server/GetterSetter.h 19 Mar 2007 17:11:14 -0000 1.5
@@ -72,7 +72,7 @@
~GetterSetter();
/// invoke the getter function
- void getValue(as_object* this_ptr, as_value& ret) const;
+ as_value getValue(as_object* this_ptr) const;
/// invoke the setter function
void setValue(as_object* this_ptr, const as_value& val) const;
Index: server/Property.h
===================================================================
RCS file: /sources/gnash/gnash/server/Property.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/Property.h 29 Oct 2006 18:34:11 -0000 1.3
+++ server/Property.h 19 Mar 2007 17:11:14 -0000 1.4
@@ -207,9 +207,7 @@
/// Get the value (invokes the getter)
as_value getValue(as_object& this_ptr) const
{
- as_value ret;
- _getset.getValue(&this_ptr, ret);
- return ret;
+ return _getset.getValue(&this_ptr);
}
/// Set the value (invokes the setter)
Index: server/PropertyList.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/PropertyList.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/PropertyList.cpp 25 Feb 2007 16:38:12 -0000 1.10
+++ server/PropertyList.cpp 19 Mar 2007 17:11:14 -0000 1.11
@@ -141,8 +141,11 @@
std::pair<bool,bool>
PropertyList::delProperty(const std::string& key)
{
+ GNASH_REPORT_FUNCTION;
iterator it=find(key);
- if ( it == end() ) return std::make_pair(false,false);
+ if ( it == end() ){
+ return std::make_pair(false,false);
+ }
// check if member is protected from deletion
if ( it->second->getFlags().get_dont_delete() )
Index: server/array.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/array.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- server/array.cpp 15 Mar 2007 22:39:53 -0000 1.52
+++ server/array.cpp 19 Mar 2007 17:11:14 -0000 1.53
@@ -127,8 +127,8 @@
env.push(b);
as_value ret(false); // bool value
- fn_call fn(&ret, NULL, &env, 2, 0);
- _comp(fn);
+ fn_call fn(NULL, &env, 2, 0);
+ ret = _comp(fn);
return ( ret.to_bool() );
}
};
@@ -468,17 +468,17 @@
return ret;
}
-static void
+static as_value
array_splice(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
UNUSED(array);
log_error("FIXME: Array.splice() method not implemented yet!\n");
- fn.result->set_undefined();
+ return as_value();
}
-static void
+static as_value
array_sort(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
@@ -496,28 +496,26 @@
else
{
log_error("Array.sort(comparator) method not implemented!\n");
- fn.result->set_undefined();
- return;
+ return as_value();
}
array->sort(flags);
- fn.result->set_undefined(); // returns void
- return;
+ return as_value(); // returns void
}
-static void
+static as_value
array_sortOn(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
UNUSED(array);
log_error("FIXME: Array.sortOn() method not implemented yet!");
- fn.result->set_undefined();
+ return as_value();
}
// Callback to push values to the back of an array
-static void
+static as_value
array_push(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
@@ -526,14 +524,14 @@
log_action("calling array push, pushing %d values onto back of
array",fn.nargs);
);
- for (int i=0;i<fn.nargs;i++)
+ for (unsigned int i=0;i<fn.nargs;i++)
array->push(fn.arg(i));
- fn.result->set_int(array->size());
+ return as_value(array->size());
}
// Callback to push values to the front of an array
-static void
+static as_value
array_unshift(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
@@ -542,61 +540,63 @@
log_action("calling array unshift, pushing %d values onto front of
array",fn.nargs);
);
- for (int i=fn.nargs-1;i>=0;i--)
+ for (int i=fn.nargs-1; i>=0; i--)
array->unshift(fn.arg(i));
- fn.result->set_int(array->size());
+ return as_value(array->size());
}
// Callback to pop a value from the back of an array
-static void
+static as_value
array_pop(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
// Get our index, log, then return result
- (*fn.result) = array->pop();
+ as_value rv = array->pop();
IF_VERBOSE_ACTION (
log_action("calling array pop, result:%s, new array size:%d",
- fn.result->to_string(), array->size());
+ rv.to_string(), array->size());
);
+ return rv;
}
// Callback to pop a value from the front of an array
-static void
+static as_value
array_shift(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
// Get our index, log, then return result
- (*fn.result) = array->shift();
+ as_value rv = array->shift();
IF_VERBOSE_ACTION (
log_action("calling array shift, result:%s, new array size:%d",
- fn.result->to_string(), array->size());
+ rv.to_string(), array->size());
);
+ return rv;
}
// Callback to reverse the position of the elements in an array
-static void
+static as_value
array_reverse(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
array->reverse();
- fn.result->set_as_object(array);
+ as_value rv = as_value(array);
IF_VERBOSE_ACTION (
log_action("called array reverse, result:%s, new array size:%d",
- fn.result->to_string(), array->size());
+ rv.to_string(), array->size());
);
-
+ return rv;
}
// Callback to convert array to a string with optional custom separator
(default ',')
-static void
+static as_value
array_join(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
@@ -608,20 +608,20 @@
std::string ret = array->join(separator);
- fn.result->set_string(ret.c_str());
+ return as_value(ret.c_str());
}
-static void
+static as_value
array_size(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
- fn.result->set_int(array->size());
+ return as_value(array->size());
}
// Callback to convert array to a string
// TODO CHECKME: rely on Object.toString ? (
-static void
+static as_value
array_to_string(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
@@ -636,7 +636,7 @@
log_action("to_string result is: %s", ret.c_str());
);
- fn.result->set_string(ret.c_str());
+ return as_value(ret.c_str());
}
/// concatenates the elements specified in the parameters with
@@ -644,7 +644,7 @@
/// value parameters specify an array, the elements of that
/// array are concatenated, rather than the array itself. The
/// array my_array is left unchanged.
-static void
+static as_value
array_concat(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
@@ -652,7 +652,7 @@
// use copy ctor
as_array_object* newarray = new as_array_object(*array);
- for (int i=0; i<fn.nargs; i++)
+ for (unsigned int i=0; i<fn.nargs; i++)
{
// Array args get concatenated by elements
if ( as_array_object* other =
dynamic_cast<as_array_object*>(fn.arg(i).to_object()) )
@@ -666,12 +666,12 @@
}
}
- fn.result->set_as_object(newarray);
+ return as_value(newarray);
}
// Callback to slice part of an array to a new array
// without changing the original
-static void
+static as_value
array_slice(const fn_call& fn)
{
as_array_object* array = ensureArray(fn.this_ptr);
@@ -693,8 +693,7 @@
if (fn.nargs < 1)
{
as_array_object* newarray = new as_array_object(*array);
- fn.result->set_as_object(newarray);
- return;
+ return as_value(newarray);
}
@@ -729,11 +728,11 @@
std::auto_ptr<as_array_object> newarray(array->slice(
startindex, endindex));
- fn.result->set_as_object(newarray.release());
+ return as_value(newarray.release());
}
-void
+as_value
array_new(const fn_call& fn)
{
IF_VERBOSE_ACTION (
@@ -764,7 +763,7 @@
{
// Use the arguments as initializers.
as_value index_number;
- for (int i = 0; i < fn.nargs; i++)
+ for (unsigned int i = 0; i < fn.nargs; i++)
{
ao->push(fn.arg(i));
}
@@ -774,8 +773,8 @@
log_action("array_new setting object %p in result", (void*)ao);
);
- //fn.result->set_as_object(ao.get());
- fn.result->set_as_object(ao);
+ //return as_value(ao.get());
+ return as_value(ao);
}
static void
Index: server/array.h
===================================================================
RCS file: /sources/gnash/gnash/server/array.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/array.h 10 Mar 2007 14:04:38 -0000 1.21
+++ server/array.h 19 Mar 2007 17:11:14 -0000 1.22
@@ -161,7 +161,7 @@
/// Constructor for ActionScript class Array.
// needed by SWFHandlers::ActionInitArray
-void array_new(const fn_call& fn);
+as_value array_new(const fn_call& fn);
}
Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- server/as_environment.cpp 16 Mar 2007 21:06:44 -0000 1.58
+++ server/as_environment.cpp 19 Mar 2007 17:11:14 -0000 1.59
@@ -16,7 +16,7 @@
//
-/* $Id: as_environment.cpp,v 1.58 2007/03/16 21:06:44 strk Exp $ */
+/* $Id: as_environment.cpp,v 1.59 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -192,6 +192,7 @@
return true;
}
+
// Try target
std::pair<bool,bool> ret = m_target->delProperty(varname);
if ( ret.first )
@@ -199,6 +200,7 @@
return ret.second;
}
+
// Try _global
return VM::get().getGlobal()->delProperty(varname).second;
}
Index: server/as_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_function.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/as_function.cpp 15 Mar 2007 22:39:53 -0000 1.21
+++ server/as_function.cpp 19 Mar 2007 17:11:14 -0000 1.22
@@ -44,10 +44,10 @@
namespace gnash {
// should be static, probably
-void function_apply(const fn_call& fn);
-void function_call(const fn_call& fn);
+as_value function_apply(const fn_call& fn);
+as_value function_call(const fn_call& fn);
static as_object* getFunctionPrototype();
-static void function_ctor(const fn_call& fn);
+static as_value function_ctor(const fn_call& fn);
/*
* This function returns the singleton
@@ -90,15 +90,12 @@
}
-static void
-function_ctor(const fn_call& fn)
+static as_value
+function_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> func = new
as_object(getFunctionPrototype());
//log_msg("User tried to invoke new Function()");
- if ( fn.result )
- {
- fn.result->set_as_object(func.get());
- }
+ return as_value(func.get());
}
@@ -185,7 +182,7 @@
return ret;
}
-void
+as_value
function_apply(const fn_call& fn)
{
int pushed=0; // new values we push on the stack
@@ -276,14 +273,15 @@
call_it:
// Call the function
- (*function_obj)(new_fn_call);
+ as_value rv = (*function_obj)(new_fn_call);
// Drop additional values we pushed on the stack
fn.env->drop(pushed);
+ return rv;
}
-void
+as_value
function_call(const fn_call& fn)
{
@@ -309,7 +307,7 @@
}
// Call the function
- (*function_obj)(new_fn_call);
+ return (*function_obj)(new_fn_call);
//log_msg("at function_call exit, stack: \n"); fn.env->dump_stack();
Index: server/as_function.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_function.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/as_function.h 15 Mar 2007 22:39:53 -0000 1.10
+++ server/as_function.h 19 Mar 2007 17:11:14 -0000 1.11
@@ -75,10 +75,10 @@
as_function* to_function() { return this; }
/// Dispatch.
- virtual void operator()(const fn_call& fn)=0;
+ virtual as_value operator()(const fn_call& fn)=0;
/// Alias for operator()
- void call(const fn_call& fn) { return operator()(fn); }
+ as_value call(const fn_call& fn) { return operator()(fn); }
/// Get this function's "prototype" member (exported interface).
//
@@ -133,8 +133,8 @@
void function_class_init(as_object& global);
// To be made statics instead
-void function_apply(const fn_call& fn);
-void function_call(const fn_call& fn);
+as_value function_apply(const fn_call& fn);
+as_value function_call(const fn_call& fn);
} // end of gnash namespace
Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/as_object.cpp 15 Mar 2007 22:39:53 -0000 1.41
+++ server/as_object.cpp 19 Mar 2007 17:11:14 -0000 1.42
@@ -532,7 +532,7 @@
}
}
-void
+as_value
as_object::tostring_method(const fn_call& fn)
{
assert(dynamic_cast<as_object*>(fn.this_ptr));
@@ -541,21 +541,21 @@
const char* text_val = obj->get_text_value();
if ( text_val )
{
- fn.result->set_string(text_val);
+ return as_value(text_val);
}
else
{
- fn.result->set_string("[object Object]");
+ return as_value("[object Object]");
}
}
-void
+as_value
as_object::valueof_method(const fn_call& fn)
{
assert(dynamic_cast<as_object*>(fn.this_ptr));
as_object* obj = static_cast<as_object*>(fn.this_ptr);
- *(fn.result) = obj->get_primitive_value();
+ return obj->get_primitive_value();
}
as_object*
Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- server/as_object.h 15 Mar 2007 22:39:53 -0000 1.43
+++ server/as_object.h 19 Mar 2007 17:11:14 -0000 1.44
@@ -395,9 +395,9 @@
/// @{ Common ActionScript methods for characters
/// TODO: make protected
- static void tostring_method(const fn_call& fn);
+ static as_value tostring_method(const fn_call& fn);
- static void valueof_method(const fn_call& fn);
+ static as_value valueof_method(const fn_call& fn);
/// @} Common ActionScript getter-setters for characters
Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/as_value.h 16 Mar 2007 21:06:44 -0000 1.32
+++ server/as_value.h 19 Mar 2007 17:11:14 -0000 1.33
@@ -14,7 +14,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: as_value.h,v 1.32 2007/03/16 21:06:44 strk Exp $ */
+/* $Id: as_value.h,v 1.33 2007/03/19 17:11:14 bjacques Exp $ */
#ifndef GNASH_AS_VALUE_H
#define GNASH_AS_VALUE_H
@@ -65,7 +65,6 @@
static inline int isinf_ld (long double x) { return isnan (x - x); }
#endif
-typedef void (*as_c_function_ptr)(const fn_call& fn);
// ActionScript value type.
@@ -583,6 +582,8 @@
};
+typedef as_value (*as_c_function_ptr)(const fn_call& fn);
+
inline std::ostream& operator<< (std::ostream& os, const as_value& v) {
return os << v.to_debug_string();
}
Index: server/builtin_function.h
===================================================================
RCS file: /sources/gnash/gnash/server/builtin_function.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/builtin_function.h 15 Dec 2006 21:25:59 -0000 1.6
+++ server/builtin_function.h 19 Mar 2007 17:11:14 -0000 1.7
@@ -27,7 +27,7 @@
namespace gnash {
-typedef void (*as_c_function_ptr)(const fn_call& fn);
+typedef as_value (*as_c_function_ptr)(const fn_call& fn);
/// Any built-in function/class should be of this type
@@ -57,10 +57,10 @@
}
/// Invoke this function or this Class constructor
- virtual void operator()(const fn_call& fn)
+ virtual as_value operator()(const fn_call& fn)
{
assert(_func);
- _func(fn);
+ return _func(fn);
}
bool isBuiltin() { return true; }
Index: server/button_character_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/button_character_instance.cpp 15 Mar 2007 22:39:53 -0000
1.33
+++ server/button_character_instance.cpp 19 Mar 2007 17:11:14 -0000
1.34
@@ -273,7 +273,7 @@
}
-void
+as_value
button_character_instance::enabled_getset(const fn_call& fn)
{
button_character_instance* ptr =
@@ -284,14 +284,17 @@
throw ActionException("enabled_getset() called against
non-character instance");
}
+ as_value rv;
+
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_bool(ptr->get_enabled());
+ rv = as_value(ptr->get_enabled());
}
else // setter
{
ptr->set_enabled(fn.arg(0).to_bool());
}
+ return rv;
}
@@ -610,8 +613,8 @@
}
// check for built-in event handler.
- as_value method;
- if ( get_event_handler(event, &method) && ! method.is_undefined() )
+ as_value method = get_event_handler(event);
+ if ( ! method.is_undefined() )
{
call_method0(method, &(get_environment()), this);
}
Index: server/button_character_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/button_character_instance.h 15 Mar 2007 22:39:53 -0000 1.16
+++ server/button_character_instance.h 19 Mar 2007 17:11:14 -0000 1.17
@@ -5,7 +5,7 @@
// SWF buttons. Mouse-sensitive update/display, actions, etc.
-/* $Id: button_character_instance.h,v 1.16 2007/03/15 22:39:53 strk Exp $ */
+/* $Id: button_character_instance.h,v 1.17 2007/03/19 17:11:14 bjacques Exp $
*/
#ifndef GNASH_BUTTON_CHARACTER_INSTANCE_H
#define GNASH_BUTTON_CHARACTER_INSTANCE_H
@@ -127,7 +127,7 @@
virtual float get_height() const;
- static void enabled_getset(const fn_call& fn);
+ static as_value enabled_getset(const fn_call& fn);
bool get_enabled();
void set_enabled(bool value);
Index: server/character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/character.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/character.cpp 15 Mar 2007 22:39:53 -0000 1.24
+++ server/character.cpp 19 Mar 2007 17:11:14 -0000 1.25
@@ -18,7 +18,7 @@
//
//
-/* $Id: character.cpp,v 1.24 2007/03/15 22:39:53 strk Exp $ */
+/* $Id: character.cpp,v 1.25 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -246,151 +246,170 @@
return ret;
}
-void
+as_value
character::onrollover_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- ptr->get_event_handler(event_id::ROLL_OVER, fn.result);
+ rv = ptr->get_event_handler(event_id::ROLL_OVER);
}
else // setter
{
ptr->set_event_handler(event_id::ROLL_OVER, fn.arg(0));
}
+ return rv;
}
-void
+as_value
character::onrollout_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- ptr->get_event_handler(event_id::ROLL_OUT, fn.result);
+ rv = ptr->get_event_handler(event_id::ROLL_OUT);
}
else // setter
{
ptr->set_event_handler(event_id::ROLL_OUT, fn.arg(0));
}
+ return rv;
}
-void
+as_value
character::onpress_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- ptr->get_event_handler(event_id::PRESS, fn.result);
+ rv = ptr->get_event_handler(event_id::PRESS);
}
else // setter
{
ptr->set_event_handler(event_id::PRESS, fn.arg(0));
}
+ return rv;
}
-void
+as_value
character::onrelease_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- ptr->get_event_handler(event_id::RELEASE, fn.result);
+ rv = ptr->get_event_handler(event_id::RELEASE);
}
else // setter
{
ptr->set_event_handler(event_id::RELEASE, fn.arg(0));
}
+ return rv;
}
-void
+as_value
character::onreleaseoutside_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- ptr->get_event_handler(event_id::RELEASE_OUTSIDE, fn.result);
+ rv = ptr->get_event_handler(event_id::RELEASE_OUTSIDE);
}
else // setter
{
ptr->set_event_handler(event_id::RELEASE_OUTSIDE, fn.arg(0));
}
+ return rv;
}
-void
+as_value
character::onmouseup_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- ptr->get_event_handler(event_id::MOUSE_UP, fn.result);
+ rv = ptr->get_event_handler(event_id::MOUSE_UP);
}
else // setter
{
ptr->set_event_handler(event_id::MOUSE_UP, fn.arg(0));
}
+ return rv;
}
-void
+as_value
character::onmousedown_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- ptr->get_event_handler(event_id::MOUSE_DOWN, fn.result);
+ rv = ptr->get_event_handler(event_id::MOUSE_DOWN);
}
else // setter
{
ptr->set_event_handler(event_id::MOUSE_DOWN, fn.arg(0));
}
+ return rv;
}
-void
+as_value
character::onmousemove_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- ptr->get_event_handler(event_id::MOUSE_MOVE, fn.result);
+ rv = ptr->get_event_handler(event_id::MOUSE_MOVE);
}
else // setter
{
ptr->set_event_handler(event_id::MOUSE_MOVE, fn.arg(0));
}
+ return rv;
}
-void
+as_value
character::onload_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- ptr->get_event_handler(event_id::LOAD, fn.result);
+ rv = ptr->get_event_handler(event_id::LOAD);
}
else // setter
{
ptr->set_event_handler(event_id::LOAD, fn.arg(0));
}
+ return rv;
}
-void
+as_value
character::x_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
matrix m = ptr->get_matrix();
- fn.result->set_double(TWIPS_TO_PIXELS(m.m_[0][2]));
+ rv = as_value(TWIPS_TO_PIXELS(m.m_[0][2]));
}
else // setter
{
@@ -399,18 +418,20 @@
ptr->set_matrix(m);
ptr->transformedByScript(); // m_accept_anim_moves = false;
}
+ return rv;;
}
-void
+as_value
character::y_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
matrix m = ptr->get_matrix();
- fn.result->set_double(TWIPS_TO_PIXELS(m.m_[1][2]));
+ rv = as_value(TWIPS_TO_PIXELS(m.m_[1][2]));
}
else // setter
{
@@ -419,19 +440,21 @@
ptr->set_matrix(m);
ptr->transformedByScript(); // m_accept_anim_moves = false;
}
+ return rv;
}
-void
+as_value
character::xscale_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
matrix m = ptr->get_matrix();
float xscale = m.get_x_scale();
- fn.result->set_double(xscale * 100); // result in percent
+ rv = as_value(xscale * 100); // result in percent
}
else // setter
{
@@ -446,7 +469,7 @@
log_aserror("Attempt to set _xscale to %g, refused",
scale_percent);
);
- return;
+ return as_value();
}
else if (scale_percent < 0 )
{
@@ -469,19 +492,21 @@
ptr->set_matrix(m);
ptr->transformedByScript(); // m_accept_anim_moves = false;
}
+ return rv;
}
-void
+as_value
character::yscale_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
matrix m = ptr->get_matrix();
float yscale = m.get_y_scale();
- fn.result->set_double(yscale * 100); // result in percent
+ rv = as_value(yscale * 100); // result in percent
}
else // setter
{
@@ -496,7 +521,7 @@
log_aserror("Attempt to set _yscale to %g, refused",
scale_percent);
);
- return;
+ return as_value();
}
else if (scale_percent < 0 )
{
@@ -519,14 +544,16 @@
ptr->set_matrix(m);
ptr->transformedByScript(); // m_accept_anim_moves = false;
}
+ return rv;
}
-void
+as_value
character::xmouse_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
// Local coord of mouse IN PIXELS.
@@ -540,7 +567,7 @@
m.transform_by_inverse(&b, a);
- fn.result->set_double(TWIPS_TO_PIXELS(b.m_x));
+ rv = as_value(TWIPS_TO_PIXELS(b.m_x));
}
else // setter
{
@@ -548,13 +575,15 @@
log_aserror("Attempt to set read-only property '_xmouse'");
);
}
+ return rv;
}
-void
+as_value
character::ymouse_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
// Local coord of mouse IN PIXELS.
@@ -568,7 +597,7 @@
m.transform_by_inverse(&b, a);
- fn.result->set_double(TWIPS_TO_PIXELS(b.m_y));
+ rv = as_value(TWIPS_TO_PIXELS(b.m_y));
}
else // setter
{
@@ -576,16 +605,18 @@
log_aserror("Attempt to set read-only property '_ymouse'");
);
}
+ return rv;
}
-void
+as_value
character::alpha_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_double(ptr->get_cxform().m_[3][0] * 100.f);
+ rv = as_value(ptr->get_cxform().m_[3][0] * 100.f);
}
else // setter
{
@@ -595,34 +626,38 @@
ptr->set_cxform(cx);
ptr->transformedByScript(); // m_accept_anim_moves = false;
}
+ return rv;
}
-void
+as_value
character::visible_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_bool(ptr->get_visible());
+ rv = as_value(ptr->get_visible());
}
else // setter
{
ptr->set_visible(fn.arg(0).to_bool());
ptr->transformedByScript(); // m_accept_anim_moves = false;
}
+ return rv;
}
-void
+as_value
character::width_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_double(TWIPS_TO_PIXELS(ptr->get_width()));
+ rv = as_value(TWIPS_TO_PIXELS(ptr->get_width()));
}
else // setter
{
@@ -637,16 +672,18 @@
ptr->set_matrix(m);
ptr->transformedByScript(); // m_accept_anim_moves = false;
}
+ return rv;
}
-void
+as_value
character::height_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_double(TWIPS_TO_PIXELS(ptr->get_height()));
+ rv = as_value(TWIPS_TO_PIXELS(ptr->get_height()));
}
else // setter
{
@@ -661,13 +698,15 @@
ptr->set_matrix(m);
ptr->transformedByScript(); // m_accept_anim_moves = false;
}
+ return rv;
}
-void
+as_value
character::rotation_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
// Verified against Macromedia player using
samples/test_rotation.swf
@@ -676,7 +715,7 @@
// Result is CLOCKWISE DEGREES, [-180,180]
angle *= 180.0f / float(M_PI);
- fn.result->set_double(angle);
+ rv = as_value(angle);
}
else // setter
{
@@ -693,18 +732,22 @@
ptr->set_matrix(m);
ptr->transformedByScript(); // m_accept_anim_moves = false;
}
+ return rv;
}
-void
+as_value
character::parent_getset(const fn_call& fn)
{
character* ptr = ensure_character(fn.this_ptr);
+ as_value rv;
if ( fn.nargs == 0 ) // getter
{
as_object* p = ptr->get_parent();
- if ( p ) fn.result->set_as_object(p);
- else { assert(fn.result->is_undefined()); }
+ if ( p )
+ {
+ rv = as_value(p);
+ }
}
else // setter
{
@@ -712,6 +755,7 @@
log_aserror("Attempt to set read-only property '_parent'");
);
}
+ return rv;
}
void
Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- server/character.h 15 Mar 2007 22:39:53 -0000 1.57
+++ server/character.h 19 Mar 2007 17:11:14 -0000 1.58
@@ -18,7 +18,7 @@
//
//
-/* $Id: character.h,v 1.57 2007/03/15 22:39:53 strk Exp $ */
+/* $Id: character.h,v 1.58 2007/03/19 17:11:14 bjacques Exp $ */
#ifndef GNASH_CHARACTER_H
#define GNASH_CHARACTER_H
@@ -143,47 +143,47 @@
public: // TODO: make protected
- static void onrollover_getset(const fn_call& fn);
+ static as_value onrollover_getset(const fn_call& fn);
- static void onrollout_getset(const fn_call& fn);
+ static as_value onrollout_getset(const fn_call& fn);
- static void onload_getset(const fn_call& fn);
+ static as_value onload_getset(const fn_call& fn);
- static void onpress_getset(const fn_call& fn);
+ static as_value onpress_getset(const fn_call& fn);
- static void onrelease_getset(const fn_call& fn);
+ static as_value onrelease_getset(const fn_call& fn);
- static void onreleaseoutside_getset(const fn_call& fn);
+ static as_value onreleaseoutside_getset(const fn_call& fn);
- static void onmouseup_getset(const fn_call& fn);
+ static as_value onmouseup_getset(const fn_call& fn);
- static void onmousedown_getset(const fn_call& fn);
+ static as_value onmousedown_getset(const fn_call& fn);
- static void onmousemove_getset(const fn_call& fn);
+ static as_value onmousemove_getset(const fn_call& fn);
- static void x_getset(const fn_call& fn);
+ static as_value x_getset(const fn_call& fn);
- static void y_getset(const fn_call& fn);
+ static as_value y_getset(const fn_call& fn);
- static void xscale_getset(const fn_call& fn);
+ static as_value xscale_getset(const fn_call& fn);
- static void yscale_getset(const fn_call& fn);
+ static as_value yscale_getset(const fn_call& fn);
- static void xmouse_getset(const fn_call& fn);
+ static as_value xmouse_getset(const fn_call& fn);
- static void ymouse_getset(const fn_call& fn);
+ static as_value ymouse_getset(const fn_call& fn);
- static void alpha_getset(const fn_call& fn);
+ static as_value alpha_getset(const fn_call& fn);
- static void visible_getset(const fn_call& fn);
+ static as_value visible_getset(const fn_call& fn);
- static void width_getset(const fn_call& fn);
+ static as_value width_getset(const fn_call& fn);
- static void height_getset(const fn_call& fn);
+ static as_value height_getset(const fn_call& fn);
- static void rotation_getset(const fn_call& fn);
+ static as_value rotation_getset(const fn_call& fn);
- static void parent_getset(const fn_call& fn);
+ static as_value parent_getset(const fn_call& fn);
/// @} Common ActionScript getter-setters for characters
@@ -305,13 +305,12 @@
/// to properly fetch any user-defined event handler, which
/// are the ones attached to a character with ActionScript code.
///
- bool get_event_handler(const event_id& id, as_value* result) const
+ as_value get_event_handler(const event_id& id) const
{
std::map<event_id, as_value>::const_iterator it = \
_event_handlers.find(id);
- if ( it == _event_handlers.end() ) return false;
- *result = it->second;
- return true;
+ if ( it == _event_handlers.end() ) return as_value();
+ return it->second;
}
/// Set a built-in function handler for the given event
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- server/edit_text_character.cpp 9 Mar 2007 15:12:08 -0000 1.45
+++ server/edit_text_character.cpp 19 Mar 2007 17:11:14 -0000 1.46
@@ -15,7 +15,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: edit_text_character.cpp,v 1.45 2007/03/09 15:12:08 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.46 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -43,21 +43,20 @@
namespace gnash {
// Forward declarations
-static void textfield_get_variable(const fn_call& fn);
-static void textfield_set_variable(const fn_call& fn);
+static as_value textfield_get_variable(const fn_call& fn);
+static as_value textfield_set_variable(const fn_call& fn);
-static void
+static as_value
textfield_get_variable(const fn_call& fn)
{
assert( dynamic_cast<edit_text_character*>(fn.this_ptr) );
edit_text_character* text =
static_cast<edit_text_character*>(fn.this_ptr);
- fn.result->set_string(text->get_variable_name());
- return;
+ return as_value(text->get_variable_name());
}
-static void
+static as_value
textfield_set_variable(const fn_call& fn)
{
assert( dynamic_cast<edit_text_character*>(fn.this_ptr) );
@@ -68,18 +67,18 @@
text->set_variable_name(newname);
- return;
+ return as_value();
}
//
// TextField interface functions
//
-static void
-textfield_ctor(const fn_call& fn)
+static as_value
+textfield_ctor(const fn_call& /* fn */)
{
log_msg("User tried to invoke new TextField()");
- fn.result->set_undefined();
+ return as_value();
}
//
Index: server/shm.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/shm.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- server/shm.cpp 19 Nov 2006 17:39:01 -0000 1.27
+++ server/shm.cpp 19 Mar 2007 17:11:14 -0000 1.28
@@ -18,7 +18,7 @@
//
//
-/* $Id: shm.cpp,v 1.27 2006/11/19 17:39:01 nihilus Exp $ */
+/* $Id: shm.cpp,v 1.28 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -498,29 +498,29 @@
// These are the callbacks used to define custom methods for our AS
// classes. This way we can examine the private data after calling a
// method to see if it worked correctly.
-void shm_getname(const fn_call& fn)
+as_value shm_getname(const fn_call& fn)
{
shm_as_object *ptr = (shm_as_object*)fn.this_ptr;
assert(ptr);
- fn.result->set_tu_string(ptr->obj.getName());
+ return as_value(ptr->obj.getName());
}
-void shm_getsize(const fn_call& fn)
+as_value shm_getsize(const fn_call& fn)
{
shm_as_object *ptr = (shm_as_object*)fn.this_ptr;
assert(ptr);
- fn.result->set_int(ptr->obj.getSize());
+ return as_value(ptr->obj.getSize());
}
-void shm_getallocated(const fn_call& fn)
+as_value shm_getallocated(const fn_call& fn)
{
shm_as_object *ptr = (shm_as_object*)fn.this_ptr;
assert(ptr);
- fn.result->set_int(ptr->obj.getAllocated());
+ return as_value(ptr->obj.getAllocated());
}
-void shm_exists(const fn_call& fn)
+as_value shm_exists(const fn_call& fn)
{
shm_as_object *ptr = (shm_as_object*)fn.this_ptr;
assert(ptr);
- fn.result->set_bool(ptr->obj.exists());
+ return as_value(ptr->obj.exists());
}
//#endif
Index: server/shm.h
===================================================================
RCS file: /sources/gnash/gnash/server/shm.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/shm.h 20 Nov 2006 23:02:36 -0000 1.13
+++ server/shm.h 19 Mar 2007 17:11:14 -0000 1.14
@@ -177,10 +177,10 @@
};
//#ifdef ENABLE_TESTING
-void shm_getname(const fn_call& fn);
-void shm_getsize(const fn_call& fn);
-void shm_getallocated(const fn_call& fn);
-void shm_exists(const fn_call& fn);
+as_value shm_getname(const fn_call& fn);
+as_value shm_getsize(const fn_call& fn);
+as_value shm_getallocated(const fn_call& fn);
+as_value shm_exists(const fn_call& fn);
//#endif
} // end of gnash namespace
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -b -r1.196 -r1.197
--- server/sprite_instance.cpp 16 Mar 2007 12:11:48 -0000 1.196
+++ server/sprite_instance.cpp 19 Mar 2007 17:11:14 -0000 1.197
@@ -122,14 +122,15 @@
return ret;
}
-static void sprite_play(const fn_call& fn)
+static as_value sprite_play(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
sprite->set_play_state(sprite_instance::PLAY);
+ return as_value();
}
-static void sprite_stop(const fn_call& fn)
+static as_value sprite_stop(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -145,10 +146,11 @@
/* sound_handler* sh = get_sound_handler();
if (sh != NULL) sh->stop_all_sounds();*/
+ return as_value();
}
//removeMovieClip() : Void
-static void sprite_remove_movieclip(const fn_call& fn)
+static as_value sprite_remove_movieclip(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -157,13 +159,15 @@
{
parent->remove_display_object(sprite->get_depth(), 0);
}
+ return as_value();
}
// attachMovie(idName:String, newName:String,
// depth:Number [, initObject:Object]) : MovieClip
-static void sprite_attach_movie(const fn_call& fn)
+static as_value sprite_attach_movie(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
+ as_value rv;
if (fn.nargs < 3 || fn.nargs > 4)
{
@@ -172,7 +176,7 @@
" expected 3 to 4, got (%d) - returning undefined",
fn.nargs);
);
- return;
+ return rv;
}
// Get exported resource
@@ -186,7 +190,7 @@
"returning undefined",
id_name.c_str());
);
- return;
+ return rv;
}
movie_definition* exported_movie =
dynamic_cast<movie_definition*>(exported.get());
if ( ! exported_movie )
@@ -198,7 +202,7 @@
id_name.c_str(),
typeid(*(exported.get())).name());
);
- return;
+ return rv;
}
std::string newname = fn.arg(1).to_std_string();
@@ -217,7 +221,7 @@
if ( ! sprite->attachCharacter(*newch, depth_val) )
{
log_error("Could not attach character at depth %d", depth_val);
- return;
+ return rv;
}
newch->setDynamic();
@@ -241,12 +245,12 @@
);
}
}
-
- fn.result->set_as_object(newch.get());
+ rv = as_value(newch.get());
+ return rv;
}
// attachAudio(id:Object) : Void
-static void sprite_attach_audio(const fn_call& fn)
+static as_value sprite_attach_audio(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
UNUSED(sprite);
@@ -258,10 +262,11 @@
"returning undefined");
warned=true;
}
+ return as_value();
}
//createEmptyMovieClip(name:String, depth:Number) : MovieClip
-static void sprite_create_empty_movieclip(const fn_call& fn)
+static as_value sprite_create_empty_movieclip(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -275,7 +280,7 @@
" returning undefined.",
fn.nargs);
);
- return;
+ return as_value();
}
else
{
@@ -289,30 +294,31 @@
}
character* ch = sprite->add_empty_movieclip(fn.arg(0).to_string(),
int(fn.arg(1).to_number()));
- fn.result->set_as_object(ch);
+ return as_value(ch);
}
-static void sprite_get_depth(const fn_call& fn)
+static as_value sprite_get_depth(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
int n = sprite->get_depth();
// Macromedia Flash help says: depth starts at -16383 (0x3FFF)
- fn.result->set_int( - (n + 16383 - 1));
+ return as_value( - (n + 16383 - 1));
}
//swapDepths(target:Object) : Void
-static void sprite_swap_depths(const fn_call& fn)
+static as_value sprite_swap_depths(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
+ as_value rv;
if (fn.nargs < 1)
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("swapDepths needs one arg");
);
- return;
+ return rv;
}
sprite_instance* target;
@@ -334,7 +340,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("swapDepths has received invalid arg\n");
);
- return;
+ return rv;
}
if (sprite == NULL || target == NULL)
@@ -342,7 +348,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("It is impossible to swap NULL character");
);
- return;
+ return rv;
}
if (sprite->get_parent() == target->get_parent() &&
sprite->get_parent() != NULL)
@@ -361,13 +367,14 @@
"with different parents");
);
}
+ return rv;
}
// 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)
+static as_value sprite_duplicate_movieclip(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -376,7 +383,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("duplicateMovieClip needs 2 or 3 args\n");
);
- return;
+ return as_value();
}
// strk question: Would a call to
@@ -426,10 +433,10 @@
}
}
- fn.result->set_as_object(ch);
+ return as_value(ch);
}
-static void sprite_goto_and_play(const fn_call& fn)
+static as_value sprite_goto_and_play(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -438,16 +445,17 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("sprite_goto_and_play needs one arg");
);
- return;
+ return as_value();
}
// Convert to 0-based
size_t target_frame = size_t(fn.arg(0).to_number() - 1);
sprite->goto_frame(target_frame);
sprite->set_play_state(sprite_instance::PLAY);
+ return as_value();
}
-static void sprite_goto_and_stop(const fn_call& fn)
+static as_value sprite_goto_and_stop(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -456,7 +464,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("sprite_goto_and_stop needs one arg");
);
- return;
+ return as_value();
}
// Convert to 0-based
@@ -464,9 +472,10 @@
sprite->goto_frame(target_frame);
sprite->set_play_state(sprite_instance::STOP);
+ return as_value();
}
-static void sprite_next_frame(const fn_call& fn)
+static as_value sprite_next_frame(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -477,9 +486,10 @@
sprite->goto_frame(current_frame + 1);
}
sprite->set_play_state(sprite_instance::STOP);
+ return as_value();
}
-static void sprite_prev_frame(const fn_call& fn)
+static as_value sprite_prev_frame(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -489,25 +499,26 @@
sprite->goto_frame(current_frame - 1);
}
sprite->set_play_state(sprite_instance::STOP);
+ return as_value();
}
-static void sprite_get_bytes_loaded(const fn_call& fn)
+static as_value sprite_get_bytes_loaded(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
- fn.result->set_int(sprite->get_bytes_loaded());
+ return as_value(sprite->get_bytes_loaded());
}
-static void sprite_get_bytes_total(const fn_call& fn)
+static as_value sprite_get_bytes_total(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
// @@ horrible uh ?
- fn.result->set_int(sprite->get_bytes_total());
+ return as_value(sprite->get_bytes_total());
}
// my_mc.loadMovie(url:String [,variables:String]) : Void
-static void sprite_load_movie(const fn_call& fn)
+static as_value sprite_load_movie(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
UNUSED(sprite);
@@ -519,7 +530,7 @@
"expected 1 or 2 args, got %d - returning undefined",
fn.nargs);
);
- return;
+ return as_value();
}
std::string urlstr = fn.arg(0).to_std_string();
@@ -532,7 +543,7 @@
"returning undefined",
ss.str().c_str());
);
- return;
+ return as_value();
}
const URL& baseurl = get_base_url();
URL url(urlstr, baseurl);
@@ -551,10 +562,11 @@
//log_error("FIXME: %s not implemented yet", __PRETTY_FUNCTION__);
//moviecliploader_loadclip(fn);
+ return as_value();
}
// my_mc.loadVariables(url:String [, variables:String]) : Void
-static void sprite_load_variables(const fn_call& fn)
+static as_value sprite_load_variables(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
UNUSED(sprite);
@@ -566,7 +578,7 @@
"expected 1 or 2 args, got %d - returning undefined",
fn.nargs);
);
- return;
+ return as_value();
}
std::string urlstr = fn.arg(0).to_std_string();
@@ -579,7 +591,7 @@
"returning undefined",
ss.str().c_str());
);
- return;
+ return as_value();
}
const URL& baseurl = get_base_url();
URL url(urlstr, baseurl);
@@ -600,10 +612,11 @@
//log_error("FIXME: %s not implemented yet", __PRETTY_FUNCTION__);
//moviecliploader_loadclip(fn);
+ return as_value();
}
// my_mc.unloadMovie() : Void
-static void sprite_unload_movie(const fn_call& fn)
+static as_value sprite_unload_movie(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
UNUSED(sprite);
@@ -616,9 +629,10 @@
log_error("FIXME: MovieClip.unloadMovie() not implemented yet");
warned=true;
}
+ return as_value();
}
-static void sprite_hit_test(const fn_call& fn)
+static as_value sprite_hit_test(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
UNUSED(sprite);
@@ -639,7 +653,7 @@
log_aserror("Can't find hitTest target %s",
tgt_val.to_string());
);
- return;
+ return as_value();
}
if ( ! warned_1_arg ) {
log_error("FIXME: hitTest(target)
unimplemented");
@@ -683,11 +697,11 @@
}
}
- return;
+ return as_value();
}
-static void
+static as_value
sprite_create_text_field(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -698,7 +712,7 @@
log_msg("createTextField called with %d args, "
"expected 6 - returning undefined", fn.nargs);
);
- return;
+ return as_value();
}
if ( ! fn.arg(0).is_string() )
@@ -707,7 +721,7 @@
log_msg("First argument of createTextField is not a string"
" - returning undefined");
);
- return;
+ return as_value();
}
std::string txt_name = fn.arg(0).to_string();
@@ -717,7 +731,7 @@
log_msg("Second argument of createTextField is not a number"
" - returning undefined");
);
- return;
+ return as_value();
}
int txt_depth = int(fn.arg(1).to_number());
@@ -727,7 +741,7 @@
log_msg("Third argument of createTextField is not a number"
" - returning undefined");
);
- return;
+ return as_value();
}
float txt_x = fn.arg(2).to_number();
@@ -737,7 +751,7 @@
log_msg("Fourth argument of createTextField is not a number"
" - returning undefined");
);
- return;
+ return as_value();
}
float txt_y = fn.arg(3).to_number();
@@ -747,7 +761,7 @@
log_msg("Fifth argument of createTextField is not a number"
" - returning undefined");
);
- return;
+ return as_value();
}
float txt_width = fn.arg(4).to_number();
@@ -757,7 +771,7 @@
log_msg("Fifth argument of createTextField is not a number"
" - returning undefined");
);
- return;
+ return as_value();
}
float txt_height = fn.arg(5).to_number();
@@ -766,21 +780,21 @@
// We should return a ref to the newly created
// TextField here
- fn.result->set_as_object(txt.get());
+ return as_value(txt.get());
}
//getNextHighestDepth() : Number
-static void
+static as_value
sprite_getNextHighestDepth(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
unsigned int nextdepth = sprite->getNextHighestDepth();
- fn.result->set_double(static_cast<double>(nextdepth));
+ return as_value(static_cast<double>(nextdepth));
}
// getURL(url:String, [window:String], [method:String]) : Void
-static void
+static as_value
sprite_getURL(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -792,10 +806,11 @@
log_error("FIXME: MovieClip.getURL() not implemented yet");
warned=true;
}
+ return as_value();
}
// getBounds(targetCoordinateSpace:Object) : Object
-static void
+static as_value
sprite_getBounds(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -829,10 +844,10 @@
warned=true;
}
- fn.result->set_as_object(bounds_obj.get());
+ return as_value(bounds_obj.get());
}
-static void
+static as_value
sprite_globalToLocal(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -844,16 +859,18 @@
log_error("FIXME: MovieClip.globalToLocal() not implemented
yet");
warned=true;
}
+ return as_value();
}
-static void
+static as_value
sprite_endFill(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
sprite->endFill();
+ return as_value();
}
-static void
+static as_value
sprite_lineTo(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -863,7 +880,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("MovieClip.lineTo() takes two args");
);
- return;
+ return as_value();
}
float x = PIXELS_TO_TWIPS(fn.arg(0).to_number());
@@ -871,9 +888,10 @@
sprite->lineTo(x, y);
+ return as_value();
}
-static void
+static as_value
sprite_moveTo(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -883,7 +901,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("MovieClip.moveTo() takes two args");
);
- return;
+ return as_value();
}
float x = PIXELS_TO_TWIPS(fn.arg(0).to_number());
@@ -891,9 +909,10 @@
sprite->moveTo(x, y);
+ return as_value();
}
-static void
+static as_value
sprite_lineStyle(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -932,9 +951,10 @@
sprite->lineStyle(thickness, color);
+ return as_value();
}
-static void
+static as_value
sprite_curveTo(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -944,7 +964,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("MovieClip.curveTo() takes four args");
);
- return;
+ return as_value();
}
float cx = PIXELS_TO_TWIPS(fn.arg(0).to_number());
@@ -954,18 +974,20 @@
sprite->curveTo(cx, cy, ax, ay);
+ return as_value();
}
-static void
+static as_value
sprite_clear(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
sprite->clear();
+ return as_value();
}
-static void
+static as_value
sprite_beginFill(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -989,9 +1011,10 @@
sprite->beginFill(color);
+ return as_value();
}
-static void
+static as_value
sprite_beginGradientFill(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -1003,11 +1026,12 @@
log_error("FIXME: MovieClip.beginGradientFill() not implemented
yet");
warned=true;
}
+ return as_value();
}
// startDrag([lockCenter:Boolean], [left:Number], [top:Number],
// [right:Number], [bottom:Number]) : Void`
-static void
+static as_value
sprite_startDrag(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -1019,10 +1043,11 @@
log_error("FIXME: MovieClip.startDrag() not implemented yet");
warned=true;
}
+ return as_value();
}
// stopDrag() : Void
-static void
+static as_value
sprite_stopDrag(const fn_call& fn)
{
sprite_instance* sprite = ensure_sprite(fn.this_ptr);
@@ -1034,27 +1059,28 @@
log_error("FIXME: MovieClip.stopDrag() not implemented yet");
warned=true;
}
+ return as_value();
}
-static void
-movieclip_ctor(const fn_call& fn)
+static as_value
+movieclip_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> clip = new
as_object(getMovieClipInterface());
//attachMovieClipProperties(*clip);
- fn.result->set_as_object(clip.get());
+ return as_value(clip.get());
}
#ifndef OLD_GET_MEMBER
-static void
+static as_value
sprite_currentframe_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_int(ptr->get_current_frame() + 1);
+ return as_value(ptr->get_current_frame() + 1);
}
else // setter
{
@@ -1063,16 +1089,17 @@
);
}
+ return as_value();
}
-static void
+static as_value
sprite_totalframes_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_int(ptr->get_frame_count());
+ return as_value(ptr->get_frame_count());
}
else // setter
{
@@ -1081,16 +1108,17 @@
);
}
+ return as_value();
}
-static void
+static as_value
sprite_framesloaded_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_int(ptr->get_loaded_frames());
+ return as_value(ptr->get_loaded_frames());
}
else // setter
{
@@ -1099,16 +1127,17 @@
);
}
+ return as_value();
}
-static void
+static as_value
sprite_target_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_string(ptr->getTargetPath().c_str());
+ return as_value(ptr->getTargetPath().c_str());
}
else // setter
{
@@ -1117,9 +1146,10 @@
);
}
+ return as_value();
}
-static void
+static as_value
sprite_name_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
@@ -1130,11 +1160,11 @@
const std::string& name = ptr->get_name();
if ( vm.getSWFVersion() < 6 && name.empty() )
{
- return;
+ return as_value();
}
else
{
- fn.result->set_string(name.c_str());
+ return as_value(name.c_str());
}
}
else // setter
@@ -1145,9 +1175,10 @@
//);
}
+ return as_value();
}
-static void
+static as_value
sprite_droptarget_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
@@ -1165,11 +1196,11 @@
VM& vm = VM::get();
if ( vm.getSWFVersion() > 5 )
{
- fn.result->set_string("");
+ return as_value("");
}
else
{
- return;
+ return as_value();
}
}
else // setter
@@ -1179,16 +1210,17 @@
);
}
+ return as_value();
}
-static void
+static as_value
sprite_url_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
if ( fn.nargs == 0 ) // getter
{
-
fn.result->set_string(ptr->get_movie_definition()->get_url().c_str());
+ return as_value(ptr->get_movie_definition()->get_url().c_str());
}
else // setter
{
@@ -1197,9 +1229,10 @@
);
}
+ return as_value();
}
-static void
+static as_value
sprite_highquality_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
@@ -1208,7 +1241,7 @@
if ( fn.nargs == 0 ) // getter
{
// We don't support quality settings
- fn.result->set_bool(true);
+ return as_value(true);
}
else // setter
{
@@ -1218,10 +1251,11 @@
warned = true;
}
}
+ return as_value();
}
// TODO: move this to character class, _focusrect seems a generic property
-static void
+static as_value
sprite_focusrect_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
@@ -1231,7 +1265,7 @@
{
// Is a yellow rectangle visible around a focused movie clip (?)
// We don't support focuserct settings
- fn.result->set_bool(false);
+ return as_value(false);
}
else // setter
{
@@ -1241,9 +1275,10 @@
warned = true;
}
}
+ return as_value();
}
-static void
+static as_value
sprite_soundbuftime_getset(const fn_call& fn)
{
sprite_instance* ptr = ensure_sprite(fn.this_ptr);
@@ -1252,7 +1287,7 @@
if ( fn.nargs == 0 ) // getter
{
// Number of seconds before sound starts to stream.
- fn.result->set_double(0.0);
+ return as_value(0.0);
}
else // setter
{
@@ -1262,6 +1297,7 @@
warned = true;
}
}
+ return as_value();
}
#endif // ndef OLD_GET_MEMBER
@@ -2187,8 +2223,9 @@
// First, check for built-in event handler.
{
- as_value method;
- if (get_event_handler(id, &method))
+ as_value method = get_event_handler(id);
+
+ if (!method.is_undefined())
{
// Dispatch.
call_method0(method, &m_as_environment, this);
@@ -3395,7 +3432,8 @@
const event_id &event = EH[i];
// Check event handlers
- if (get_event_handler(event.id(), &dummy))
+ dummy = get_event_handler(event.id());
+ if (!dummy.is_undefined())
{
return true;
}
@@ -3740,10 +3778,10 @@
set_prototype(proto);
//log_msg("Calling the user-defined constructor against this
sprite_instance");
- as_value ret; // we don't use the constructor return (should
we?)
- fn_call call(&ret, this, &(get_environment()), 0, 0);
- (*ctor)(call);
+ fn_call call(this, &(get_environment()), 0, 0);
+ // we don't use the constructor return (should we?)
+ (*ctor)(call);
}
}
Index: server/swf_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/swf_function.cpp 17 Mar 2007 17:55:31 -0000 1.23
+++ server/swf_function.cpp 19 Mar 2007 17:11:14 -0000 1.24
@@ -150,7 +150,7 @@
// Super class prototype is : obj.__proto__.constructor.prototype
as_array_object* arguments = new as_array_object();
- for (int i=0; i<fn.nargs; ++i)
+ for (unsigned int i=0; i<fn.nargs; ++i)
{
arguments->push(fn.arg(i));
}
@@ -161,7 +161,7 @@
}
// Dispatch.
-void
+as_value
swf_function::operator()(const fn_call& fn)
{
@@ -322,10 +322,12 @@
// Execute the actions.
//ActionExec exec(*m_action_buffer, *our_env, m_start_pc, m_length,
fn.result, m_with_stack, m_is_function2);
- ActionExec exec(*this, *our_env, fn.result, fn.this_ptr);
+ as_value result;
+ ActionExec exec(*this, *our_env, &result, fn.this_ptr);
exec();
our_env->popCallFrame();
+ return result;
}
void
Index: server/swf_function.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/swf_function.h 28 Feb 2007 07:46:23 -0000 1.9
+++ server/swf_function.h 19 Mar 2007 17:11:14 -0000 1.10
@@ -220,7 +220,7 @@
void set_length(int len);
/// Dispatch.
- void operator()(const fn_call& fn);
+ as_value operator()(const fn_call& fn);
//void lazy_create_properties();
};
Index: server/textformat.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/textformat.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/textformat.cpp 9 Mar 2007 15:00:59 -0000 1.17
+++ server/textformat.cpp 19 Mar 2007 17:11:14 -0000 1.18
@@ -114,7 +114,7 @@
}
#endif
-void textformat_new(const fn_call& fn)
+as_value textformat_new(const fn_call& fn)
{
//log_msg("%s: args=%d\n", __FUNCTION__, nargs);
@@ -129,11 +129,11 @@
// instead of doing this.
fn.env->set_variable("setTextFormat", new
builtin_function(textformat_setformat));
- fn.result->set_as_object(text_obj);
+ return as_value(text_obj);
}
-void textformat_setformat(const fn_call& fn)
+as_value textformat_setformat(const fn_call& fn)
{
as_value method;
//log_msg("%s: args=%d at %p\n", __FUNCTION__, nargs, this_ptr);
@@ -213,6 +213,7 @@
//ptr->obj.setTextFormat(start, end, obj->obj);
//result->set_bool(true);
+ return as_value();
}
#if 0
void
Index: server/textformat.h
===================================================================
RCS file: /sources/gnash/gnash/server/textformat.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/textformat.h 3 Nov 2006 14:03:37 -0000 1.12
+++ server/textformat.h 19 Mar 2007 17:11:14 -0000 1.13
@@ -195,9 +195,9 @@
text_format obj;
};
-DSOEXPORT void textformat_new(const fn_call& fn);
-DSOEXPORT void textformat_setformat(const fn_call& fn);
-DSOEXPORT void textformat_getformat(const fn_call& fn);
+DSOEXPORT as_value textformat_new(const fn_call& fn);
+DSOEXPORT as_value textformat_setformat(const fn_call& fn);
+DSOEXPORT as_value textformat_getformat(const fn_call& fn);
} // end of gnash namespace
Index: server/timers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/timers.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/timers.cpp 19 Mar 2007 14:41:27 -0000 1.23
+++ server/timers.cpp 19 Mar 2007 17:11:14 -0000 1.24
@@ -18,7 +18,7 @@
//
//
-/* $Id: timers.cpp,v 1.23 2007/03/19 14:41:27 strk Exp $ */
+/* $Id: timers.cpp,v 1.24 2007/03/19 17:11:14 bjacques Exp $ */
#include "timers.h"
#include "as_function.h" // for class as_function
@@ -110,7 +110,7 @@
}
// TODO: move to Global.cpp
-void
+as_value
timer_setinterval(const fn_call& fn)
{
//log_msg("%s: args=%d", __FUNCTION__, fn.nargs);
@@ -124,7 +124,7 @@
"- need at least 2 arguments",
ss.str().c_str());
);
- return;
+ return as_value();
}
unsigned timer_arg = 1;
@@ -138,7 +138,7 @@
"- first argument is not an object or function",
ss.str().c_str());
);
- return;
+ return as_value();
}
// Get interval function
@@ -156,7 +156,7 @@
ss.str().c_str(), method_name.c_str(),
fn.arg(0).to_debug_string().c_str());
);
- return;
+ return as_value();
}
as_func = method.to_as_function();
if ( ! as_func )
@@ -169,7 +169,7 @@
fn.arg(0).to_debug_string().c_str(),
method_name.c_str());
);
- return;
+ return as_value();
}
timer_arg = 2;
@@ -184,7 +184,7 @@
"- missing timeout argument",
ss.str().c_str());
);
- return;
+ return as_value();
}
// Get interval time
@@ -203,11 +203,11 @@
movie_root& root = VM::get().getRoot();
int id = root.add_interval_timer(timer);
- fn.result->set_int(id);
+ return as_value(id);
}
// TODO: move to Global.cpp
-void
+as_value
timer_clearinterval(const fn_call& fn)
{
//log_msg("%s: nargs = %d", __FUNCTION__, fn.nargs);
@@ -216,7 +216,7 @@
movie_root& root = VM::get().getRoot();
bool ret = root.clear_interval_timer(id);
- fn.result->set_bool(ret);
+ return as_value(ret);
}
} // namespace gnash
Index: server/timers.h
===================================================================
RCS file: /sources/gnash/gnash/server/timers.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/timers.h 9 Feb 2007 13:38:50 -0000 1.14
+++ server/timers.h 19 Mar 2007 17:11:14 -0000 1.15
@@ -139,9 +139,9 @@
};
- void timer_setinterval(const fn_call& fn);
- void timer_clearinterval(const fn_call& fn);
- void timer_expire(const fn_call& fn);
+ as_value timer_setinterval(const fn_call& fn);
+ as_value timer_clearinterval(const fn_call& fn);
+ as_value timer_expire(const fn_call& fn);
} // end of namespace gnash
Index: server/video_stream_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/video_stream_instance.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/video_stream_instance.cpp 9 Mar 2007 15:00:59 -0000 1.14
+++ server/video_stream_instance.cpp 19 Mar 2007 17:11:14 -0000 1.15
@@ -15,7 +15,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: video_stream_instance.cpp,v 1.14 2007/03/09 15:00:59 strk Exp $
+// $Id: video_stream_instance.cpp,v 1.15 2007/03/19 17:11:14 bjacques Exp $
#include "sprite_instance.h"
#include "video_stream_instance.h"
@@ -29,7 +29,7 @@
namespace gnash {
- static void
+ static as_value
attach_video(const fn_call& fn)
{
assert(dynamic_cast<video_stream_instance*>(fn.this_ptr));
@@ -40,7 +40,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("attachVideo needs 1 arg");
);
- return;
+ return as_value();
}
NetStream* ns = dynamic_cast<NetStream*>(fn.arg(0).to_object());
@@ -48,6 +48,7 @@
{
video->setStream(ns);
}
+ return as_value();
}
video_stream_instance::video_stream_instance(
Index: server/asobj/Boolean.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Boolean.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/Boolean.cpp 15 Mar 2007 22:39:53 -0000 1.7
+++ server/asobj/Boolean.cpp 19 Mar 2007 17:11:14 -0000 1.8
@@ -30,9 +30,9 @@
namespace gnash {
-void boolean_tostring(const fn_call& fn);
-void boolean_valueof(const fn_call& fn);
-void boolean_ctor(const fn_call& fn);
+as_value boolean_tostring(const fn_call& fn);
+as_value boolean_valueof(const fn_call& fn);
+as_value boolean_ctor(const fn_call& fn);
static void
attachBooleanInterface(as_object& o)
@@ -93,7 +93,7 @@
return ret;
}
-void boolean_tostring(const fn_call& fn) {
+as_value boolean_tostring(const fn_call& fn) {
static char* strtrue = "true";
static char* strfalse = "false";
@@ -101,18 +101,18 @@
boolean_as_object* boolobj = ensureBoolean(fn.this_ptr);
if (boolobj->val)
- fn.result->set_string(strtrue);
+ return as_value(strtrue);
else
- fn.result->set_string(strfalse);
+ return as_value(strfalse);
}
-void boolean_valueof(const fn_call& fn) {
+as_value boolean_valueof(const fn_call& fn) {
boolean_as_object* boolobj = ensureBoolean(fn.this_ptr);
- fn.result->set_bool(boolobj->val);
+ return as_value(boolobj->val);
}
-void
+as_value
boolean_ctor(const fn_call& fn)
{
bool val = false;
@@ -122,7 +122,7 @@
}
boost::intrusive_ptr<as_object> obj = new boolean_as_object(val);
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/Camera.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Camera.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/Camera.cpp 4 Mar 2007 01:39:01 -0000 1.5
+++ server/asobj/Camera.cpp 19 Mar 2007 17:11:14 -0000 1.6
@@ -29,11 +29,11 @@
namespace gnash {
-void camera_get(const fn_call& fn);
-void camera_setmode(const fn_call& fn);
-void camera_setmotionlevel(const fn_call& fn);
-void camera_setquality(const fn_call& fn);
-void camera_ctor(const fn_call& fn);
+as_value camera_get(const fn_call& fn);
+as_value camera_setmode(const fn_call& fn);
+as_value camera_setmotionlevel(const fn_call& fn);
+as_value camera_setquality(const fn_call& fn);
+as_value camera_ctor(const fn_call& fn);
static void
attachCameraInterface(as_object& o)
@@ -73,25 +73,30 @@
//double get_numeric_value() const { return 0; }
};
-void camera_get(const fn_call& /*fn*/) {
+as_value camera_get(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void camera_setmode(const fn_call& /*fn*/) {
+as_value camera_setmode(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void camera_setmotionlevel(const fn_call& /*fn*/) {
+as_value camera_setmotionlevel(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void camera_setquality(const fn_call& /*fn*/) {
+as_value camera_setquality(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+
+ return as_value();
}
-void
-camera_ctor(const fn_call& fn)
+as_value
+camera_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new camera_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/Color.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Color.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/Color.cpp 4 Mar 2007 01:39:01 -0000 1.7
+++ server/asobj/Color.cpp 19 Mar 2007 17:11:14 -0000 1.8
@@ -29,11 +29,11 @@
namespace gnash {
-void color_getrgb(const fn_call& fn);
-void color_gettransform(const fn_call& fn);
-void color_setrgb(const fn_call& fn);
-void color_settransform(const fn_call& fn);
-void color_ctor(const fn_call& fn);
+as_value color_getrgb(const fn_call& fn);
+as_value color_gettransform(const fn_call& fn);
+as_value color_setrgb(const fn_call& fn);
+as_value color_settransform(const fn_call& fn);
+as_value color_ctor(const fn_call& fn);
static void
attachColorInterface(as_object& o)
@@ -73,7 +73,7 @@
//double get_numeric_value() const { return 0; }
};
-void color_getrgb(const fn_call& /*fn*/)
+as_value color_getrgb(const fn_call& /*fn*/)
{
static bool warned = false;
if ( ! warned )
@@ -81,9 +81,10 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void color_gettransform(const fn_call& /*fn*/)
+as_value color_gettransform(const fn_call& /*fn*/)
{
static bool warned = false;
if ( ! warned )
@@ -91,9 +92,10 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void color_setrgb(const fn_call& /*fn*/)
+as_value color_setrgb(const fn_call& /*fn*/)
{
static bool warned = false;
if ( ! warned )
@@ -101,9 +103,10 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void color_settransform(const fn_call& /*fn*/)
+as_value color_settransform(const fn_call& /*fn*/)
{
static bool warned = false;
if ( ! warned )
@@ -111,14 +114,15 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void
-color_ctor(const fn_call& fn)
+as_value
+color_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new color_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/ContextMenu.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/ContextMenu.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/asobj/ContextMenu.cpp 7 Mar 2007 22:47:53 -0000 1.8
+++ server/asobj/ContextMenu.cpp 19 Mar 2007 17:11:14 -0000 1.9
@@ -104,11 +104,11 @@
/// Get the ContextMenu.prototype ActionScript object
static as_object* getExportedInterface();
- static void ctor_method(const fn_call& fn);
+ static as_value ctor_method(const fn_call& fn);
- static void hideBuiltInItems_method(const fn_call& fn);
+ static as_value hideBuiltInItems_method(const fn_call& fn);
- static void copy_method(const fn_call& fn);
+ static as_value copy_method(const fn_call& fn);
};
/* static private */
@@ -134,25 +134,27 @@
/* static private */
-void
+as_value
ContextMenu::copy_method(const fn_call& fn)
{
ContextMenu* ptr = ensureContextMenu(fn.this_ptr);
UNUSED(ptr);
log_warning("%s: unimplemented", __FUNCTION__);
+ return as_value();
}
/* static private */
-void
+as_value
ContextMenu::hideBuiltInItems_method(const fn_call& fn)
{
ContextMenu* ptr = ensureContextMenu(fn.this_ptr);
UNUSED(ptr);
log_warning("%s: unimplemented", __FUNCTION__);
+ return as_value();
}
/* static private */
-void
+as_value
ContextMenu::ctor_method(const fn_call& fn)
{
boost::intrusive_ptr<as_object> obj;
@@ -161,7 +163,7 @@
else
obj = new ContextMenu();
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
/* static public */
Index: server/asobj/CustomActions.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/CustomActions.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/CustomActions.cpp 4 Mar 2007 01:39:01 -0000 1.5
+++ server/asobj/CustomActions.cpp 19 Mar 2007 17:11:14 -0000 1.6
@@ -29,11 +29,11 @@
namespace gnash {
-void customactions_get(const fn_call& fn);
-void customactions_install(const fn_call& fn);
-void customactions_list(const fn_call& fn);
-void customactions_uninstall(const fn_call& fn);
-void customactions_ctor(const fn_call& fn);
+as_value customactions_get(const fn_call& fn);
+as_value customactions_install(const fn_call& fn);
+as_value customactions_list(const fn_call& fn);
+as_value customactions_uninstall(const fn_call& fn);
+as_value customactions_ctor(const fn_call& fn);
static void
attachCustomActionsInterface(as_object& o)
@@ -73,25 +73,29 @@
//double get_numeric_value() const { return 0; }
};
-void customactions_get(const fn_call& /*fn*/) {
+as_value customactions_get(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void customactions_install(const fn_call& /*fn*/) {
+as_value customactions_install(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void customactions_list(const fn_call& /*fn*/) {
+as_value customactions_list(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void customactions_uninstall(const fn_call& /*fn*/) {
+as_value customactions_uninstall(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void
-customactions_ctor(const fn_call& fn)
+as_value
+customactions_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new customactions_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/Date.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Date.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- server/asobj/Date.cpp 17 Mar 2007 11:33:02 -0000 1.34
+++ server/asobj/Date.cpp 19 Mar 2007 17:11:14 -0000 1.35
@@ -219,47 +219,47 @@
// forward declarations
-static void date_new(const fn_call& fn);
-static void date_getdate(const fn_call& fn);
-static void date_getday(const fn_call& fn);
-static void date_getfullyear(const fn_call& fn);
-static void date_gethours(const fn_call& fn);
-static void date_getmilliseconds(const fn_call& fn);
-static void date_getminutes(const fn_call& fn);
-static void date_getmonth(const fn_call& fn);
-static void date_getseconds(const fn_call& fn);
-// static void date_gettime(const fn_call& fn); == date_valueof()
-static void date_gettimezoneoffset(const fn_call& fn);
-static void date_getutcdate(const fn_call& fn);
-static void date_getutcday(const fn_call& fn);
-static void date_getutcfullyear(const fn_call& fn);
-static void date_getutchours(const fn_call& fn);
-static void date_getutcminutes(const fn_call& fn);
-static void date_getutcmonth(const fn_call& fn);
-static void date_getutcseconds(const fn_call& fn);
-//static void date_getutcmilliseconds(const fn_call& fn); // == getmilliseconds
-static void date_getyear(const fn_call& fn);
-static void date_setdate(const fn_call& fn);
-static void date_setfullyear(const fn_call& fn);
-static void date_sethours(const fn_call& fn);
-static void date_setmilliseconds(const fn_call& fn);
-static void date_setminutes(const fn_call& fn);
-static void date_setmonth(const fn_call& fn);
-static void date_setseconds(const fn_call& fn);
-static void date_settime(const fn_call& fn);
-static void date_setutcdate(const fn_call& fn);
-static void date_setutcfullyear(const fn_call& fn);
-static void date_setutchours(const fn_call& fn);
-//static void date_setutcmilliseconds(const fn_call& fn); // == setmilliseconds
-static void date_setutcminutes(const fn_call& fn);
-static void date_setutcmonth(const fn_call& fn);
-static void date_setutcseconds(const fn_call& fn);
-static void date_setyear(const fn_call& fn);
-static void date_tostring(const fn_call& fn);
-static void date_valueof(const fn_call& fn);
+static as_value date_new(const fn_call& fn);
+static as_value date_getdate(const fn_call& fn);
+static as_value date_getday(const fn_call& fn);
+static as_value date_getfullyear(const fn_call& fn);
+static as_value date_gethours(const fn_call& fn);
+static as_value date_getmilliseconds(const fn_call& fn);
+static as_value date_getminutes(const fn_call& fn);
+static as_value date_getmonth(const fn_call& fn);
+static as_value date_getseconds(const fn_call& fn);
+// static as_value date_gettime(const fn_call& fn); == date_valueof()
+static as_value date_gettimezoneoffset(const fn_call& fn);
+static as_value date_getutcdate(const fn_call& fn);
+static as_value date_getutcday(const fn_call& fn);
+static as_value date_getutcfullyear(const fn_call& fn);
+static as_value date_getutchours(const fn_call& fn);
+static as_value date_getutcminutes(const fn_call& fn);
+static as_value date_getutcmonth(const fn_call& fn);
+static as_value date_getutcseconds(const fn_call& fn);
+//static as_value date_getutcmilliseconds(const fn_call& fn); // ==
getmilliseconds
+static as_value date_getyear(const fn_call& fn);
+static as_value date_setdate(const fn_call& fn);
+static as_value date_setfullyear(const fn_call& fn);
+static as_value date_sethours(const fn_call& fn);
+static as_value date_setmilliseconds(const fn_call& fn);
+static as_value date_setminutes(const fn_call& fn);
+static as_value date_setmonth(const fn_call& fn);
+static as_value date_setseconds(const fn_call& fn);
+static as_value date_settime(const fn_call& fn);
+static as_value date_setutcdate(const fn_call& fn);
+static as_value date_setutcfullyear(const fn_call& fn);
+static as_value date_setutchours(const fn_call& fn);
+//static as_value date_setutcmilliseconds(const fn_call& fn); // ==
setmilliseconds
+static as_value date_setutcminutes(const fn_call& fn);
+static as_value date_setutcmonth(const fn_call& fn);
+static as_value date_setutcseconds(const fn_call& fn);
+static as_value date_setyear(const fn_call& fn);
+static as_value date_tostring(const fn_call& fn);
+static as_value date_valueof(const fn_call& fn);
// Static AS methods
-static void date_utc(const fn_call& fn);
+static as_value date_utc(const fn_call& fn);
static as_object* getDateInterface();
static void attachDateInterface(as_object& o);
@@ -358,7 +358,7 @@
/// specify the year 50AD is as -1850.
/// Defaults are 0 except for date (day of month) whose default it 1.
-void
+as_value
date_new(const fn_call& fn)
{
// TODO: just make date_as_object constructor
@@ -434,7 +434,7 @@
}
}
- fn.result->set_as_object(date);
+ return as_value(date);
}
// Wrapper around dynamic_cast to implement user warning.
@@ -465,11 +465,11 @@
// gmtime_r and localtime_r or our own local equivalents.
#define date_get_proto(function, timefn, element) \
- static void function(const fn_call& fn) { \
+ static as_value function(const fn_call& fn) { \
date_as_object* date = ensure_date_object(fn.this_ptr); \
time_t t = (time_t)(date->value / 1000.0); \
struct tm tm; \
- fn.result->set_int(_##timefn##_r(&t, &tm)->element); \
+ return as_value(_##timefn##_r(&t, &tm)->element); \
}
/// \brief Date.getYear
@@ -522,9 +522,9 @@
//
// Also implements Date.getUTCMilliseconds
-static void date_getmilliseconds(const fn_call& fn) {
+static as_value date_getmilliseconds(const fn_call& fn) {
date_as_object* date = ensure_date_object(fn.this_ptr);
- fn.result->set_int((int) std::fmod(date->value, 1000.0));
+ return as_value((int) std::fmod(date->value, 1000.0));
}
// The same functions for universal time.
@@ -579,8 +579,8 @@
/// \brief Date.getTimezoneOffset
/// returns the difference between localtime and UTC.
-static void date_gettimezoneoffset(const fn_call& fn) {
- fn.result->set_int(minutes_east_of_gmt());
+static as_value date_gettimezoneoffset(const fn_call& /* fn */) {
+ return as_value(minutes_east_of_gmt());
}
@@ -591,7 +591,7 @@
/// \brief Date.setTime
/// sets a Date in milliseconds after January 1, 1970 00:00 UTC.
/// Returns value is the same aqs the paramemeter.
-static void date_settime(const fn_call& fn) {
+static as_value date_settime(const fn_call& fn) {
date_as_object* date = ensure_date_object(fn.this_ptr);
// assert(fn.nargs == 1);
@@ -608,7 +608,7 @@
)
}
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
//
@@ -760,7 +760,7 @@
// Heaven knows what happens if it is 1.30 localtime and you change the date
// to the day the clocks go forward.
-static void _date_setfullyear(const fn_call& fn, bool utc) {
+static as_value _date_setfullyear(const fn_call& fn, bool utc) {
date_as_object* date = ensure_date_object(fn.this_ptr);
// assert(fn.nargs >= 1 && fn.nargs <= 3);
@@ -784,7 +784,7 @@
}
tm_msec_to_date(tm, msec, date, utc);
}
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
/// \brief Date.setYear(year[,month[,day]])
@@ -802,7 +802,7 @@
//
// There is no setUTCYear() function.
-static void date_setyear(const fn_call& fn) {
+static as_value date_setyear(const fn_call& fn) {
date_as_object* date = ensure_date_object(fn.this_ptr);
// assert(fn.nargs == 1);
@@ -827,7 +827,7 @@
}
tm_msec_to_date(tm, msec, date, false);
}
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
/// \brief Date.setMonth(month[,day])
@@ -838,7 +838,7 @@
/// the day should be set to the last day of the specified month.
/// This implementation currently wraps it into the next month, which is wrong.
-static void _date_setmonth(const fn_call& fn, bool utc) {
+static as_value _date_setmonth(const fn_call& fn, bool utc) {
date_as_object* date = ensure_date_object(fn.this_ptr);
// assert(fn.nargs >= 1 && fn.nargs <= 2);
@@ -860,7 +860,7 @@
}
tm_msec_to_date(tm, msec, date, utc);
}
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
/// \brief Date.setDate(day)
@@ -869,7 +869,7 @@
/// the first days of the following month. This also happens if you set the
/// day > 31. Example: setting the 35th in January results in Feb 4th.
-static void _date_setdate(const fn_call& fn, bool utc) {
+static as_value _date_setdate(const fn_call& fn, bool utc) {
date_as_object* date = ensure_date_object(fn.this_ptr);
if (fn.nargs < 1) {
@@ -888,7 +888,7 @@
log_aserror("Date.setDate was called with more than one
argument");
)
}
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
/// \brief Date.setHours(hour[,min[,sec[,millisec]]])
@@ -903,7 +903,7 @@
/// The only way to set a fractional number of milliseconds is to use
/// setTime(n) or call the constructor with one argument.
-static void _date_sethours(const fn_call& fn, bool utc) {
+static as_value _date_sethours(const fn_call& fn, bool utc) {
date_as_object* date = ensure_date_object(fn.this_ptr);
// assert(fn.nargs >= 1 && fn.nargs <= 4);
@@ -929,7 +929,7 @@
}
tm_msec_to_date(tm, msec, date, utc);
}
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
/// \brief Date.setMinutes(minutes[,secs[,millisecs]])
@@ -940,7 +940,7 @@
/// or calendar day.
/// Similarly, negative values carry you back into the previous
minute/hour/day.
-static void _date_setminutes(const fn_call& fn, bool utc) {
+static as_value _date_setminutes(const fn_call& fn, bool utc) {
date_as_object* date = ensure_date_object(fn.this_ptr);
//assert(fn.nargs >= 1 && fn.nargs <= 3);
@@ -964,7 +964,7 @@
}
tm_msec_to_date(tm, msec, date, utc);
}
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
/// \brief Date.setSeconds(secs[,millisecs])
@@ -973,7 +973,7 @@
/// Values <0, >59 for secs or >999 for millisecs take the date back to the
/// previous minute (or hour or calendar day) or on to the following ones.
-static void _date_setseconds(const fn_call& fn, bool utc) {
+static as_value _date_setseconds(const fn_call& fn, bool utc) {
date_as_object* date = ensure_date_object(fn.this_ptr);
// assert(fn.nargs >= 1 && fn.nargs <= 2);
@@ -999,10 +999,10 @@
}
tm_msec_to_date(tm, msec, date, utc);
}
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
-static void date_setmilliseconds(const fn_call& fn) {
+static as_value date_setmilliseconds(const fn_call& fn) {
date_as_object* date = ensure_date_object(fn.this_ptr);
// assert(fn.nargs == 1);
@@ -1019,13 +1019,14 @@
)
}
}
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
// Bindings for localtime versions
#define local_proto(item) \
- static void date_set##item(const fn_call& fn) { \
+ static as_value date_set##item(const fn_call& fn) { \
_date_set##item(fn, false); \
+ return as_value(); \
}
local_proto(fullyear)
local_proto(month)
@@ -1037,8 +1038,9 @@
// The same things for UTC.
#define utc_proto(item) \
- static void date_setutc##item(const fn_call& fn) { \
+ static as_value date_setutc##item(const fn_call& fn) { \
_date_set##item(fn, true); \
+ return as_value(); \
}
utc_proto(fullyear)
utc_proto(month)
@@ -1054,7 +1056,7 @@
/// The format is "Thu Jan 1 00:00:00 GMT+0000 1970" and it is displayed in
/// local time.
-static void date_tostring(const fn_call& fn) {
+static as_value date_tostring(const fn_call& fn) {
char buffer[40]; // 32 chars + slop
char* monthname[12] =
{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
@@ -1106,7 +1108,7 @@
tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
tzhours, tzminutes, tm.tm_year+1900);
- fn.result->set_string((char *)&buffer);
+ return as_value((char *)&buffer);
}
// Date.UTC(year:Number,month[,day[,hour[,minute[,second[,millisecond]]]]]
@@ -1133,7 +1135,7 @@
static double rogue_date_args(const fn_call& fn); // Forward decl
-static void date_utc(const fn_call& fn) {
+static as_value date_utc(const fn_call& fn) {
struct tm tm; // Date structure for values down to seconds
double millisecs; // and the miliseconds component.
double result; // Resulting Flash timestamp
@@ -1142,15 +1144,13 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Date.UTC needs one argument");
)
- fn.result->set_undefined();
- return;
+ return as_value();
}
// Check for presence of NaNs and Infinities in the arguments
// and return the appropriate value if so.
if ( (result = rogue_date_args(fn)) != 0.0) {
- fn.result->set_double(result);
- return;
+ return as_value(result);
}
// Preset default values
@@ -1186,7 +1186,7 @@
}
result = utc_tm_msec_to_date(tm, millisecs);
- fn.result->set_double(result);
+ return as_value(result);
}
// Auxillary function checks for Infinities and NaN in a function's args and
@@ -1201,7 +1201,7 @@
double infinity = 0.0; // The kind of infinity we found.
// 0.0 == none yet.
- for (int i = 0; i < fn.nargs; i++) {
+ for (unsigned int i = 0; i < fn.nargs; i++) {
double arg = fn.arg(i).to_number();
if (isnan(arg)) return(NAN);
@@ -1233,9 +1233,9 @@
/// number of milliseconds.
// Also used to implement Date.getTime()
-static void date_valueof(const fn_call& fn) {
+static as_value date_valueof(const fn_call& fn) {
date_as_object* date = ensure_date_object(fn.this_ptr);
- fn.result->set_double(date->value);
+ return as_value(date->value);
}
// extern (used by Global.cpp)
Index: server/asobj/Error.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Error.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/Error.cpp 4 Mar 2007 01:39:01 -0000 1.6
+++ server/asobj/Error.cpp 19 Mar 2007 17:11:14 -0000 1.7
@@ -29,8 +29,8 @@
namespace gnash {
-void error_tostring(const fn_call& fn);
-void error_ctor(const fn_call& fn);
+as_value error_tostring(const fn_call& fn);
+as_value error_ctor(const fn_call& fn);
static void
attachErrorInterface(as_object& o)
@@ -69,16 +69,17 @@
//double get_numeric_value() const { return 0; }
};
-void error_tostring(const fn_call& /*fn*/) {
+as_value error_tostring(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void
-error_ctor(const fn_call& fn)
+as_value
+error_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new error_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- server/asobj/Global.cpp 15 Mar 2007 22:39:53 -0000 1.51
+++ server/asobj/Global.cpp 19 Mar 2007 17:11:14 -0000 1.52
@@ -18,7 +18,7 @@
// Implementation of the Global ActionScript Object
-/* $Id: Global.cpp,v 1.51 2007/03/15 22:39:53 strk Exp $ */
+/* $Id: Global.cpp,v 1.52 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -79,7 +79,7 @@
IF_VERBOSE_ASCODING_ERRORS( \
log_aserror("%s needs one argument", __FUNCTION__);
\
) \
- return; \
+ return as_value();
\
} \
IF_VERBOSE_ASCODING_ERRORS(
\
if (fn.nargs > 1) \
@@ -92,7 +92,7 @@
static Extension et;
-static void
+static as_value
as_global_trace(const fn_call& fn)
{
ASSERT_FN_ARGS_IS_1
@@ -105,23 +105,24 @@
// as_value::to_string() will take care of everything
const char* arg0 = fn.arg(0).to_string();
log_trace("%s", arg0);
+ return as_value();
}
-static void
+static as_value
as_global_isnan(const fn_call& fn)
{
ASSERT_FN_ARGS_IS_1
- fn.result->set_bool( isnan(fn.arg(0).to_number(fn.env)) );
+ return as_value( static_cast<bool>(isnan(fn.arg(0).to_number(fn.env)) ));
}
-static void
+static as_value
as_global_isfinite(const fn_call& fn)
{
ASSERT_FN_ARGS_IS_1
- fn.result->set_bool( isfinite(fn.arg(0).to_number(fn.env)) );
+ return as_value( isfinite(fn.arg(0).to_number(fn.env)) );
}
/// \brief Encode a string to URL-encoded format
@@ -136,14 +137,14 @@
/// See RFC1738 http://www.rfc-editor.org/rfc/rfc1738.txt,
/// Section 2.2 "URL Character Encoding Issues"
-static void
+static as_value
as_global_escape(const fn_call& fn)
{
ASSERT_FN_ARGS_IS_1
string input = fn.arg(0).to_string();
URL::encode(input);
- fn.result->set_string(input.c_str());
+ return as_value(input.c_str());
}
/// \brief Decode a string from URL-encoded format
@@ -154,32 +155,35 @@
/// See RFC1738 http://www.rfc-editor.org/rfc/rfc1738.txt,
/// Section 2.2 "URL Character Encoding Issues"
-static void
+static as_value
as_global_unescape(const fn_call& fn)
{
ASSERT_FN_ARGS_IS_1
string input = fn.arg(0).to_string();
URL::decode(input);
- fn.result->set_string(input.c_str());
+ return as_value(input.c_str());
}
-static void
+static as_value
as_global_parsefloat(const fn_call& fn)
{
ASSERT_FN_ARGS_IS_1
float result;
+ as_value rv;
// sscanf will handle the whitespace / unneeded characters etc.
automatically
if (1 == sscanf(fn.arg(0).to_string(), "%f", &result))
- fn.result->set_double(double(result));
+ rv = double(result);
else
// if sscanf didn't find anything, return NaN
- fn.result->set_nan();
+ rv.set_nan();
+
+ return rv;
}
-static void
+static as_value
as_global_parseint(const fn_call& fn)
{
// assert(fn.nargs == 2 || fn.nargs == 1);
@@ -187,7 +191,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("%s needs at least one argument", __FUNCTION__);
)
- return;
+ return as_value();
}
IF_VERBOSE_ASCODING_ERRORS(
if (fn.nargs > 2)
@@ -248,9 +252,10 @@
if (base < 2 || base > 36)
{
- fn.result->set_nan();
delete [] input_buffer;
- return;
+ as_value rv;
+ rv.set_nan();
+ return rv;
}
int numdigits = 0;
@@ -265,9 +270,10 @@
// If we didn't get any digits, we should return NaN
if (numdigits == 0)
{
- fn.result->set_nan();
delete [] input_buffer;
- return;
+ as_value rv;
+ rv.set_nan();
+ return rv;
}
int result = 0;
@@ -282,11 +288,11 @@
delete [] input_buffer;
// Now return the parsed string
- fn.result->set_int(result);
+ return as_value(result);
}
// ASSetPropFlags function
-static void
+static as_value
as_global_assetpropflags(const fn_call& fn)
{
int version = fn.env->get_version();
@@ -301,7 +307,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("%s needs at least three arguments", __FUNCTION__);
)
- return;
+ return as_value();
}
IF_VERBOSE_ASCODING_ERRORS(
if (fn.nargs > 4)
@@ -319,7 +325,7 @@
log_warning("Invalid call to ASSetPropFlags: "
"object argument is not an object: %s",
fn.arg(0).to_string());
- return;
+ return as_value();
}
// list of child names
@@ -344,6 +350,7 @@
obj->setPropFlags(props, set_false, set_true);
+ return as_value();
}
Global::Global(VM& vm)
Index: server/asobj/Key.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Key.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/asobj/Key.cpp 4 Mar 2007 02:21:29 -0000 1.16
+++ server/asobj/Key.cpp 19 Mar 2007 17:11:14 -0000 1.17
@@ -75,11 +75,11 @@
{
log_msg("%s:unimplemented \n", __FUNCTION__);
}
-void
-key_new(const fn_call& fn)
+as_value
+key_new(const fn_call& /* fn */)
{
key_as_object *key_obj = new key_as_object;
- fn.result->set_as_object(key_obj);
+ return as_value(key_obj);
}
/************************************************************************
@@ -222,65 +222,64 @@
}
-void
+as_value
key_add_listener(const fn_call& fn)
{
if (fn.nargs < 1)
{
log_error("key_add_listener needs one argument (the listener
object)\n");
- return;
+ return as_value();
}
as_object* listener = fn.arg(0).to_object();
if (listener == NULL)
{
log_error("key_add_listener passed a NULL object; ignored\n");
- return;
+ return as_value();
}
key_as_object* ko = static_cast<key_as_object*>( fn.this_ptr );
assert(ko);
ko->add_listener(listener);
+ return as_value();
}
-void key_get_ascii(const fn_call& fn)
+as_value key_get_ascii(const fn_call& fn)
// Return the ascii value of the last key pressed.
{
key_as_object* ko = static_cast<key_as_object*>( fn.this_ptr );
assert(ko);
- fn.result->set_undefined();
-
int code = ko->get_last_key_pressed();
- if (code > 0)
- {
+ if (code < 0)
+ return as_value();
+
// @@ Crude for now; just jamming the key code in a string, as a
character.
// Need to apply shift/capslock/numlock, etc...
char buf[2];
buf[0] = (char) code;
buf[1] = 0;
- fn.result->set_string(buf);
- }
+ return as_value(buf);
}
-void key_get_code(const fn_call& fn)
+as_value key_get_code(const fn_call& fn)
// Returns the keycode of the last key pressed.
{
key_as_object* ko = static_cast<key_as_object*>( fn.this_ptr );
assert(ko);
- fn.result->set_int(ko->get_last_key_pressed());
+ return as_value(ko->get_last_key_pressed());
}
-void key_is_down(const fn_call& fn)
+as_value key_is_down(const fn_call& fn)
// Return true if the specified (first arg keycode) key is pressed.
{
if (fn.nargs < 1)
{
log_error("key_is_down needs one argument (the key code)\n");
- return;
+ return as_value();
}
int code = (int) fn.arg(0).to_number();
@@ -288,37 +287,38 @@
key_as_object* ko = static_cast<key_as_object*>( fn.this_ptr );
assert(ko);
- fn.result->set_bool(ko->is_key_down(code));
+ return as_value(ko->is_key_down(code));
}
-void key_is_toggled(const fn_call& fn)
+as_value key_is_toggled(const fn_call& /* fn */)
// Given the keycode of NUM_LOCK or CAPSLOCK, returns true if
// the associated state is on.
{
// @@ TODO
- fn.result->set_bool(false);
+ return as_value(false);
}
-void key_remove_listener(const fn_call& fn)
+as_value key_remove_listener(const fn_call& fn)
// Remove a previously-added listener.
{
if (fn.nargs < 1)
{
log_error("key_remove_listener needs one argument (the listener
object)\n");
- return;
+ return as_value();
}
as_object* listener = fn.arg(0).to_object();
if (listener == NULL)
{
log_error("key_remove_listener passed a NULL object; ignored\n");
- return;
+ return as_value();
}
key_as_object* ko = static_cast<key_as_object*>( fn.this_ptr );
assert(ko);
ko->remove_listener(listener);
+ return as_value();
}
void notify_key_event(key::code k, bool down)
Index: server/asobj/Key.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Key.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/asobj/Key.h 18 Jan 2007 22:53:21 -0000 1.11
+++ server/asobj/Key.h 19 Mar 2007 17:11:14 -0000 1.12
@@ -16,7 +16,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: Key.h,v 1.11 2007/01/18 22:53:21 strk Exp $ */
+/* $Id: Key.h,v 1.12 2007/03/19 17:11:14 bjacques Exp $ */
#ifndef __KEY_H__
#define __KEY_H__
@@ -77,12 +77,12 @@
//Key obj;
//};
-void key_addlistener(const fn_call& fn);
-void key_getascii(const fn_call& fn);
-void key_getcode(const fn_call& fn);
-void key_isdown(const fn_call& fn);
-void key_istoggled(const fn_call& fn);
-void key_removelistener(const fn_call& fn);
+as_value key_addlistener(const fn_call& fn);
+as_value key_getascii(const fn_call& fn);
+as_value key_getcode(const fn_call& fn);
+as_value key_isdown(const fn_call& fn);
+as_value key_istoggled(const fn_call& fn);
+as_value key_removelistener(const fn_call& fn);
/************************************************************************
*
Index: server/asobj/LoadVars.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/LoadVars.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/asobj/LoadVars.cpp 15 Mar 2007 22:39:53 -0000 1.14
+++ server/asobj/LoadVars.cpp 19 Mar 2007 17:11:14 -0000 1.15
@@ -42,13 +42,13 @@
namespace gnash {
-static void loadvars_addrequestheader(const fn_call& fn);
-static void loadvars_decode(const fn_call& fn);
-static void loadvars_load(const fn_call& fn);
-static void loadvars_send(const fn_call& fn);
-static void loadvars_sendandload(const fn_call& fn);
-static void loadvars_tostring(const fn_call& fn);
-static void loadvars_ctor(const fn_call& fn);
+static as_value loadvars_addrequestheader(const fn_call& fn);
+static as_value loadvars_decode(const fn_call& fn);
+static as_value loadvars_load(const fn_call& fn);
+static as_value loadvars_send(const fn_call& fn);
+static as_value loadvars_sendandload(const fn_call& fn);
+static as_value loadvars_tostring(const fn_call& fn);
+static as_value loadvars_ctor(const fn_call& fn);
//static as_object* getLoadVarsInterface();
//static void attachLoadVarsInterface(as_object& o);
@@ -155,10 +155,10 @@
size_t processLoaded(LoadVariablesThread& lr);
/// Dispatch load event, if any
- void dispatchLoadEvent();
+ as_value dispatchLoadEvent();
/// Dispatch data event, if any
- void dispatchDataEvent();
+ as_value dispatchDataEvent();
void setLoadHandler(as_function* fn) {
_onLoad = fn;
@@ -176,17 +176,17 @@
_onData = fn;
}
- static void checkLoads_wrapper(const fn_call& fn);
+ static as_value checkLoads_wrapper(const fn_call& fn);
- static void loaded_getset(const fn_call& fn);
+ static as_value loaded_getset(const fn_call& fn);
- static void onData_getset(const fn_call& fn);
+ static as_value onData_getset(const fn_call& fn);
- static void onLoad_getset(const fn_call& fn);
+ static as_value onLoad_getset(const fn_call& fn);
- static void getBytesLoaded_method(const fn_call& fn);
+ static as_value getBytesLoaded_method(const fn_call& fn);
- static void getBytesTotal_method(const fn_call& fn);
+ static as_value getBytesTotal_method(const fn_call& fn);
boost::intrusive_ptr<as_function> _onLoad;
@@ -304,33 +304,31 @@
}
/*private*/
-void
+as_value
LoadVars::dispatchDataEvent()
{
- if ( ! _onData ) return;
+ if ( ! _onData ) return as_value();
//log_msg("Calling _onData func");
// This would be the function calls "context"
// will likely be the same to all events
- as_value ret;
- fn_call fn(&ret, this, _env, 0, 0);
+ fn_call fn(this, _env, 0, 0);
- _onData->call(fn);
+ return _onData->call(fn);
}
/* private */
-void
+as_value
LoadVars::dispatchLoadEvent()
{
- if ( ! _onLoad ) return;
+ if ( ! _onLoad ) return as_value();
//log_msg("Calling _onLoad func");
// This would be the function calls "context"
// will likely be the same to all events
- as_value ret;
- fn_call fn(&ret, this, _env, 0, 0);
+ fn_call fn(this, _env, 0, 0);
- _onLoad->call(fn);
+ return _onLoad->call(fn);
}
/* private */
@@ -444,7 +442,7 @@
}
/* private static */
-void
+as_value
LoadVars::onLoad_getset(const fn_call& fn)
{
LoadVars* ptr = ensureLoadVars(fn.this_ptr);
@@ -452,27 +450,28 @@
if ( fn.nargs == 0 ) // getter
{
as_function* h = ptr->getLoadHandler();
- if ( h ) fn.result->set_as_function(h);
- else fn.result->set_undefined();
+ if ( h ) return as_value(h);
+ else return as_value();
}
else // setter
{
as_function* h = fn.arg(0).to_as_function();
if ( h ) ptr->setLoadHandler(h);
}
+ return as_value();
}
/* private static */
-void
+as_value
LoadVars::checkLoads_wrapper(const fn_call& fn)
{
LoadVars* ptr = ensureLoadVars(fn.this_ptr);
ptr->checkLoads();
-
+ return as_value();
}
/* private static */
-void
+as_value
LoadVars::onData_getset(const fn_call& fn)
{
@@ -481,18 +480,19 @@
if ( fn.nargs == 0 ) // getter
{
as_function* h = ptr->getDataHandler();
- if ( h ) fn.result->set_as_function(h);
- else fn.result->set_undefined();
+ if ( h ) return as_value(h);
+ else return as_value();
}
else // setter
{
as_function* h = fn.arg(0).to_as_function();
if ( h ) ptr->setDataHandler(h);
}
+ return as_value();
}
/* private static */
-void
+as_value
LoadVars::loaded_getset(const fn_call& fn)
{
@@ -500,49 +500,51 @@
if ( fn.nargs == 0 ) // getter
{
- fn.result->set_bool(ptr->loaded() > 0);
+ return as_value(ptr->loaded() > 0);
}
else // setter
{
IF_VERBOSE_ASCODING_ERRORS(
log_msg("Tried to set LoadVars.loaded, which is a
read-only property");
);
- return;
+ return as_value();
}
}
-static void
+static as_value
loadvars_addrequestheader(const fn_call& fn)
{
LoadVars* ptr = ensureLoadVars(fn.this_ptr);
UNUSED(ptr);
log_error("%s: unimplemented", __FUNCTION__);
+ return as_value();
}
-static void
+static as_value
loadvars_decode(const fn_call& fn)
{
LoadVars* ptr = ensureLoadVars(fn.this_ptr);
UNUSED(ptr);
log_error("%s: unimplemented", __FUNCTION__);
+ return as_value();
}
-void
+as_value
LoadVars::getBytesLoaded_method(const fn_call& fn)
{
LoadVars* ptr = ensureLoadVars(fn.this_ptr);
- fn.result->set_int(ptr->getBytesLoaded());
+ return as_value(ptr->getBytesLoaded());
}
-void
+as_value
LoadVars::getBytesTotal_method(const fn_call& fn)
{
LoadVars* ptr = ensureLoadVars(fn.this_ptr);
- fn.result->set_int(ptr->getBytesTotal());
+ return as_value(ptr->getBytesTotal());
}
-static void
+static as_value
loadvars_load(const fn_call& fn)
{
LoadVars* obj = ensureLoadVars(fn.this_ptr);
@@ -552,8 +554,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("LoadVars.load() requires at least one argument");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
std::string urlstr = fn.arg(0).to_std_string();
@@ -562,24 +563,24 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("LoadVars.load(): invalid empty url ");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
obj->load(urlstr);
- fn.result->set_bool(true);
+ return as_value(true);
}
-static void
+static as_value
loadvars_send(const fn_call& fn)
{
LoadVars* ptr = ensureLoadVars(fn.this_ptr);
UNUSED(ptr);
log_error("%s: unimplemented", __FUNCTION__);
+ return as_value();
}
-static void
+static as_value
loadvars_sendandload(const fn_call& fn)
{
LoadVars* ptr = ensureLoadVars(fn.this_ptr);
@@ -589,8 +590,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("LoadVars.sendAndLoad() requires at least two
arguments");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
std::string urlstr = fn.arg(0).to_std_string();
@@ -599,8 +599,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("LoadVars.sendAndLoad(): invalid empty url ");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
LoadVars* target = dynamic_cast<LoadVars*>(fn.arg(1).to_object());
@@ -609,8 +608,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("LoadVars.sendAndLoad(): invalid target (must be a
LoadVars object)");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
// Post by default, override by ActionScript third argument
@@ -620,23 +618,24 @@
//log_msg("LoadVars.sendAndLoad(%s, %p) called, and returning TRUE",
urlstr.c_str(), target);
ptr->sendAndLoad(urlstr, *target, post);
- fn.result->set_bool(true);
+ return as_value(true);
}
-static void
+static as_value
loadvars_tostring(const fn_call& fn)
{
LoadVars* ptr = ensureLoadVars(fn.this_ptr);
UNUSED(ptr);
log_error("%s: unimplemented", __FUNCTION__);
+ return as_value();
}
-static void
+static as_value
loadvars_ctor(const fn_call& fn)
{
boost::intrusive_ptr<as_object> obj = new LoadVars(fn.env);
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/LocalConnection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/LocalConnection.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/LocalConnection.cpp 4 Mar 2007 01:39:01 -0000 1.7
+++ server/asobj/LocalConnection.cpp 19 Mar 2007 17:11:14 -0000 1.8
@@ -99,8 +99,8 @@
}
/// \brief Instantiate a new LocalConnection object within a flash movie
-void
-localconnection_new(const fn_call& fn)
+as_value
+localconnection_new(const fn_call& /* fn */)
{
localconnection_as_object *localconnection_obj = new
localconnection_as_object;
@@ -116,11 +116,11 @@
localconnection_obj->init_member("exists", new
builtin_function(shm_exists));
#endif
- fn.result->set_as_object(localconnection_obj);
+ return as_value(localconnection_obj);
}
/// \brief The callback for LocalConnection::close()
-void localconnection_close(const fn_call& fn)
+as_value localconnection_close(const fn_call& fn)
{
// log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
@@ -128,10 +128,11 @@
assert(ptr);
ptr->obj.close();
+ return as_value();
}
/// \brief The callback for LocalConnection::connect()
-void localconnection_connect(const fn_call& fn)
+as_value localconnection_connect(const fn_call& fn)
{
// log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
bool ret;
@@ -145,22 +146,23 @@
ret = ptr->obj.connect("localhost"); // FIXME: This should probably
// fail instead
}
- fn.result->set_bool(ret);
+ return as_value(ret);
}
/// \brief The callback for LocalConnection::domain()
-void localconnection_domain(const fn_call& fn)
+as_value localconnection_domain(const fn_call& fn)
{
// log_msg("%s:\n", __PRETTY_FUNCTION__);
localconnection_as_object *ptr = (localconnection_as_object*)fn.this_ptr;
assert(ptr);
- fn.result->set_tu_string(ptr->obj.domain().c_str());
+ return as_value(ptr->obj.domain().c_str());
}
// \brief The callback for LocalConnection::send()
-void localconnection_send(const fn_call& /*fn*/)
+as_value localconnection_send(const fn_call& /*fn*/)
{
log_msg("%s:unimplemented \n", __FUNCTION__);
+ return as_value();
}
} // end of gnash namespace
Index: server/asobj/LocalConnection.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/LocalConnection.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/LocalConnection.h 20 Nov 2006 21:38:11 -0000 1.7
+++ server/asobj/LocalConnection.h 19 Mar 2007 17:11:14 -0000 1.8
@@ -67,11 +67,11 @@
LocalConnection obj;
};
-void localconnection_new(const fn_call& fn);
-void localconnection_close(const fn_call& fn);
-void localconnection_connect(const fn_call& fn);
-void localconnection_domain(const fn_call& fn);
-void localconnection_send(const fn_call& fn);
+as_value localconnection_new(const fn_call& fn);
+as_value localconnection_close(const fn_call& fn);
+as_value localconnection_connect(const fn_call& fn);
+as_value localconnection_domain(const fn_call& fn);
+as_value localconnection_send(const fn_call& fn);
} // end of gnash namespace
Index: server/asobj/Math.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Math.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/asobj/Math.cpp 4 Mar 2007 01:39:01 -0000 1.19
+++ server/asobj/Math.cpp 19 Mar 2007 17:11:14 -0000 1.20
@@ -16,7 +16,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: Math.cpp,v 1.19 2007/03/04 01:39:01 strk Exp $ */
+/* $Id: Math.cpp,v 1.20 2007/03/19 17:11:14 bjacques Exp $ */
//
// This file implements methods of the ActionScript Math class.
@@ -50,24 +50,24 @@
namespace gnash {
-void math_fabs(const fn_call& fn); // Implements AS "abs"
-void math_acos(const fn_call& fn);
-void math_asin(const fn_call& fn);
-void math_atan(const fn_call& fn);
-void math_atan2(const fn_call& fn);
-void math_ceil(const fn_call& fn);
-void math_cos(const fn_call& fn);
-void math_exp(const fn_call& fn);
-void math_floor(const fn_call& fn);
-void math_log(const fn_call& fn);
-void math_max(const fn_call& fn);
-void math_min(const fn_call& fn);
-void math_pow(const fn_call& fn);
-void math_random(const fn_call& fn);
-void math_round(const fn_call& fn);
-void math_sin(const fn_call& fn);
-void math_sqrt(const fn_call& fn);
-void math_tan(const fn_call& fn);
+as_value math_fabs(const fn_call& fn); // Implements AS "abs"
+as_value math_acos(const fn_call& fn);
+as_value math_asin(const fn_call& fn);
+as_value math_atan(const fn_call& fn);
+as_value math_atan2(const fn_call& fn);
+as_value math_ceil(const fn_call& fn);
+as_value math_cos(const fn_call& fn);
+as_value math_exp(const fn_call& fn);
+as_value math_floor(const fn_call& fn);
+as_value math_log(const fn_call& fn);
+as_value math_max(const fn_call& fn);
+as_value math_min(const fn_call& fn);
+as_value math_pow(const fn_call& fn);
+as_value math_random(const fn_call& fn);
+as_value math_round(const fn_call& fn);
+as_value math_sin(const fn_call& fn);
+as_value math_sqrt(const fn_call& fn);
+as_value math_tan(const fn_call& fn);
void
math_class_init(as_object& global)
@@ -89,7 +89,7 @@
//
#define MATH_WRAP_FUNC1(funcname) \
- void math_##funcname(const fn_call& fn) \
+ as_value math_##funcname(const fn_call& fn) \
{ \
double result; \
if (fn.nargs < 1) result = NAN; \
@@ -97,7 +97,7 @@
double arg = fn.arg(0).to_number(); \
result = funcname(arg); \
} \
- fn.result->set_double(result); \
+ return as_value(result); \
}
#ifndef __GNUC__ //Some hacks are ugly and dirty, we call them 'fulhack'.
@@ -130,7 +130,7 @@
// Fortunately, pow() in the cmath library works the same way.
#define MATH_WRAP_FUNC2_EXP(funcname, expr) \
- void math_##funcname(const fn_call& fn) \
+ as_value math_##funcname(const fn_call& fn) \
{ \
double result; \
if (fn.nargs < 2) result = NAN; \
@@ -139,7 +139,7 @@
double arg1 = fn.arg(1).to_number(); \
result = (expr); \
} \
- fn.result->set_double(result); \
+ return as_value(result); \
}
MATH_WRAP_FUNC2_EXP(atan2, (atan2(arg0, arg1)))
@@ -148,13 +148,13 @@
MATH_WRAP_FUNC2_EXP(pow, (pow(arg0, arg1)))
// A couple of oddballs.
-void math_random(const fn_call& fn)
+as_value math_random(const fn_call& /* fn */)
{
// Random number between 0 and 1.
- fn.result->set_double(tu_random::next_random() /
double(uint32_t(0x0FFFFFFFF)));
+ return as_value(tu_random::next_random() / double(uint32_t(0x0FFFFFFFF)));
}
-void math_round(const fn_call& fn)
+as_value math_round(const fn_call& fn)
{
// round argument to nearest int. 0.5 goes to 1 and -0.5 goes to 0
double result;
@@ -164,7 +164,7 @@
double arg0 = fn.arg(0).to_number();
result = floor(arg0 + 0.5);
}
- fn.result->set_double(result);
+ return as_value(result);
}
Index: server/asobj/Microphone.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Microphone.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/Microphone.cpp 4 Mar 2007 01:39:01 -0000 1.5
+++ server/asobj/Microphone.cpp 19 Mar 2007 17:11:14 -0000 1.6
@@ -29,12 +29,12 @@
namespace gnash {
-void microphone_get(const fn_call& fn);
-void microphone_setgain(const fn_call& fn);
-void microphone_setrate(const fn_call& fn);
-void microphone_setsilencelevel(const fn_call& fn);
-void microphone_setuseechosuppression(const fn_call& fn);
-void microphone_ctor(const fn_call& fn);
+as_value microphone_get(const fn_call& fn);
+as_value microphone_setgain(const fn_call& fn);
+as_value microphone_setrate(const fn_call& fn);
+as_value microphone_setsilencelevel(const fn_call& fn);
+as_value microphone_setuseechosuppression(const fn_call& fn);
+as_value microphone_ctor(const fn_call& fn);
static void
attachMicrophoneInterface(as_object& o)
@@ -75,28 +75,33 @@
//double get_numeric_value() const { return 0; }
};
-void microphone_get(const fn_call& /*fn*/) {
+as_value microphone_get(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void microphone_setgain(const fn_call& /*fn*/) {
+as_value microphone_setgain(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void microphone_setrate(const fn_call& /*fn*/) {
+as_value microphone_setrate(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void microphone_setsilencelevel(const fn_call& /*fn*/) {
+as_value microphone_setsilencelevel(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void microphone_setuseechosuppression(const fn_call& /*fn*/) {
+as_value microphone_setuseechosuppression(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void
-microphone_ctor(const fn_call& fn)
+as_value
+microphone_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new microphone_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/Mouse.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Mouse.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/Mouse.cpp 4 Mar 2007 01:39:01 -0000 1.5
+++ server/asobj/Mouse.cpp 19 Mar 2007 17:11:14 -0000 1.6
@@ -29,11 +29,11 @@
namespace gnash {
-void mouse_addlistener(const fn_call& fn);
-void mouse_hide(const fn_call& fn);
-void mouse_removelistener(const fn_call& fn);
-void mouse_show(const fn_call& fn);
-void mouse_ctor(const fn_call& fn);
+as_value mouse_addlistener(const fn_call& fn);
+as_value mouse_hide(const fn_call& fn);
+as_value mouse_removelistener(const fn_call& fn);
+as_value mouse_show(const fn_call& fn);
+as_value mouse_ctor(const fn_call& fn);
static void
attachMouseInterface(as_object& o)
@@ -73,25 +73,29 @@
//double get_numeric_value() const { return 0; }
};
-void mouse_addlistener(const fn_call& /*fn*/) {
+as_value mouse_addlistener(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void mouse_hide(const fn_call& /*fn*/) {
+as_value mouse_hide(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void mouse_removelistener(const fn_call& /*fn*/) {
+as_value mouse_removelistener(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void mouse_show(const fn_call& /*fn*/) {
+as_value mouse_show(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void
-mouse_ctor(const fn_call& fn)
+as_value
+mouse_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new mouse_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/MovieClipLoader.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/MovieClipLoader.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/asobj/MovieClipLoader.cpp 4 Mar 2007 02:00:42 -0000 1.19
+++ server/asobj/MovieClipLoader.cpp 19 Mar 2007 17:11:14 -0000 1.20
@@ -45,12 +45,12 @@
namespace gnash {
// Forward declarations
-static void moviecliploader_loadclip(const fn_call& fn);
-static void moviecliploader_unloadclip(const fn_call& fn);
-static void moviecliploader_getprogress(const fn_call& fn);
-static void moviecliploader_new(const fn_call& fn);
-static void moviecliploader_addlistener(const fn_call& fn);
-static void moviecliploader_removelistener(const fn_call& fn);
+static as_value moviecliploader_loadclip(const fn_call& fn);
+static as_value moviecliploader_unloadclip(const fn_call& fn);
+static as_value moviecliploader_getprogress(const fn_call& fn);
+static as_value moviecliploader_new(const fn_call& fn);
+static as_value moviecliploader_addlistener(const fn_call& fn);
+static as_value moviecliploader_removelistener(const fn_call& fn);
static void
attachMovieClipLoaderInterface(as_object& o)
@@ -175,7 +175,7 @@
// Prepare function call for events...
as_environment env;
env.push(as_value(&target));
- fn_call events_call(NULL, this, &env, 1, 0);
+ fn_call events_call(this, &env, 1, 0);
URL url(url_str.c_str(), get_base_url());
@@ -301,7 +301,7 @@
}
-static void
+static as_value
moviecliploader_loadclip(const fn_call& fn)
{
as_value val, method;
@@ -321,7 +321,7 @@
if ( ! url_arg.is_string() )
{
log_error("Malformed SWF, MovieClipLoader.loadClip() first
argument is not a string (%s)", url_arg.to_string());
- fn.result->set_bool(false);
+ return as_value(false);
return;
}
#endif
@@ -331,16 +331,14 @@
if ( ! target )
{
log_error("Could not find target %s", fn.arg(1).to_string());
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
sprite_instance* sprite = dynamic_cast<sprite_instance*>(target);
if ( ! sprite )
{
log_error("Target is not a sprite instance (%s)",
typeid(*target).name());
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
#if GNASH_DEBUG
@@ -350,31 +348,31 @@
bool ret = ptr->loadClip(str_url, *sprite);
- fn.result->set_bool(ret);
+ return as_value(ret);
}
-static void
+static as_value
moviecliploader_unloadclip(const fn_call& fn)
{
const std::string filespec = fn.arg(0).to_string();
log_msg("%s: FIXME: Load Movie Clip: %s\n", __FUNCTION__, filespec.c_str());
-
+ return as_value();
}
-static void
-moviecliploader_new(const fn_call& fn)
+static as_value
+moviecliploader_new(const fn_call& /* fn */)
{
as_object* mov_obj = new MovieClipLoader;
//log_msg("MovieClipLoader instance @ %p", mov_obj);
- fn.result->set_as_object(mov_obj); // will store in a boost::intrusive_ptr
+ return as_value(mov_obj); // will store in a boost::intrusive_ptr
}
// Invoked every time the loading content is written to disk during
// the loading process.
-static void
+static as_value
moviecliploader_getprogress(const fn_call& fn)
{
//log_msg("%s: nargs = %d\n", __FUNCTION__, nargs);
@@ -391,10 +389,10 @@
mcl_obj->init_member("bytesLoaded", mcl_data->bytes_loaded);
mcl_obj->init_member("bytesTotal", mcl_data->bytes_total);
- fn.result->set_as_object(mcl_obj); // will store in a boost::intrusive_ptr
+ return as_value(mcl_obj); // will store in a boost::intrusive_ptr
}
-static void
+static as_value
moviecliploader_addlistener(const fn_call& fn)
{
assert(dynamic_cast<MovieClipLoader*>(fn.this_ptr));
@@ -404,13 +402,14 @@
if ( ! listener )
{
log_error("ActionScript bug: Listener given to
MovieClipLoader.addListener() is not an object");
- return;
+ return as_value();
}
mcl->addListener(listener);
+ return as_value();
}
-static void
+static as_value
moviecliploader_removelistener(const fn_call& fn)
{
assert(dynamic_cast<MovieClipLoader*>(fn.this_ptr));
@@ -420,10 +419,11 @@
if ( ! listener )
{
log_error("ActionScript bug: Listener given to
MovieClipLoader.removeListener() is not an object");
- return;
+ return as_value();
}
mcl->removeListener(listener);
+ return as_value();
}
Index: server/asobj/NetConnection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetConnection.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- server/asobj/NetConnection.cpp 9 Mar 2007 14:38:29 -0000 1.28
+++ server/asobj/NetConnection.cpp 19 Mar 2007 17:11:14 -0000 1.29
@@ -14,7 +14,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: NetConnection.cpp,v 1.28 2007/03/09 14:38:29 tgc Exp $ */
+/* $Id: NetConnection.cpp,v 1.29 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -41,8 +41,8 @@
namespace gnash {
-static void netconnection_new(const fn_call& fn);
-static void netconnection_connect(const fn_call& fn);
+static as_value netconnection_new(const fn_call& fn);
+static as_value netconnection_connect(const fn_call& fn);
static as_object* getNetConnectionInterface();
/// \class NetConnection
@@ -174,17 +174,17 @@
/// \param fn the parameters from the Flash movie
/// \return nothing from the function call.
/// \note The return value is returned through the fn.result member.
-static void
-netconnection_new(const fn_call& fn)
+static as_value
+netconnection_new(const fn_call& /* fn */)
{
GNASH_REPORT_FUNCTION;
NetConnection *netconnection_obj = new NetConnection;
- fn.result->set_as_object(netconnection_obj);
+ return as_value(netconnection_obj);
}
-static void
+static as_value
netconnection_connect(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -194,6 +194,7 @@
if (fn.nargs > 0) {
ptr->addToURL(fn.arg(0).to_string());
}
+ return as_value();
}
void
Index: server/asobj/NetStream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- server/asobj/NetStream.cpp 9 Mar 2007 14:38:29 -0000 1.29
+++ server/asobj/NetStream.cpp 19 Mar 2007 17:11:14 -0000 1.30
@@ -15,7 +15,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: NetStream.cpp,v 1.29 2007/03/09 14:38:29 tgc Exp $ */
+/* $Id: NetStream.cpp,v 1.30 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -38,13 +38,13 @@
namespace gnash {
-static void netstream_new(const fn_call& fn);
-static void netstream_close(const fn_call& fn);
-static void netstream_pause(const fn_call& fn);
-static void netstream_play(const fn_call& fn);
-static void netstream_seek(const fn_call& fn);
-static void netstream_setbuffertime(const fn_call& fn);
-static void netstream_time(const fn_call& fn);
+static as_value netstream_new(const fn_call& fn);
+static as_value netstream_close(const fn_call& fn);
+static as_value netstream_pause(const fn_call& fn);
+static as_value netstream_play(const fn_call& fn);
+static as_value netstream_seek(const fn_call& fn);
+static as_value netstream_setbuffertime(const fn_call& fn);
+static as_value netstream_time(const fn_call& fn);
static as_object* getNetStreamInterface();
NetStream::NetStream()
@@ -54,7 +54,7 @@
{
}
-static void
+static as_value
netstream_new(const fn_call& fn)
{
@@ -86,7 +86,7 @@
);
}
}
- fn.result->set_as_object(netstream_obj);
+ return as_value(netstream_obj);
}
@@ -104,13 +104,14 @@
}
-static void netstream_close(const fn_call& fn)
+static as_value netstream_close(const fn_call& fn)
{
NetStream* ns = ensure_netstream(fn.this_ptr);
ns->close();
+ return as_value();
}
-static void netstream_pause(const fn_call& fn)
+static as_value netstream_pause(const fn_call& fn)
{
NetStream* ns = ensure_netstream(fn.this_ptr);
@@ -121,9 +122,10 @@
mode = fn.arg(0).to_bool() ? 0 : 1;
}
ns->pause(mode); // toggle mode
+ return as_value();
}
-static void netstream_play(const fn_call& fn)
+static as_value netstream_play(const fn_call& fn)
{
NetStream* ns = ensure_netstream(fn.this_ptr);
@@ -132,16 +134,17 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("NetStream play needs args");
);
- return;
+ return as_value();
}
if (ns->play(fn.arg(0).to_string()) != 0)
{
ns->close();
};
+ return as_value();
}
-static void netstream_seek(const fn_call& fn) {
+static as_value netstream_seek(const fn_call& fn) {
NetStream* ns = ensure_netstream(fn.this_ptr);
double time = 0;
@@ -151,15 +154,17 @@
}
ns->seek(time);
+ return as_value();
}
-static void netstream_setbuffertime(const fn_call& fn) {
+static as_value netstream_setbuffertime(const fn_call& fn) {
NetStream* ns = ensure_netstream(fn.this_ptr);
UNUSED(ns);
log_msg("%s:unimplemented \n", __FUNCTION__);
+ return as_value();
}
// Both a getter and a (do-nothing) setter for time
-static void
+static as_value
netstream_time(const fn_call& fn)
{
@@ -167,7 +172,7 @@
if ( fn.nargs == 0 )
{
- fn.result->set_double(ns->time());
+ return as_value(static_cast<double>(ns->time()));
}
else
{
@@ -175,10 +180,11 @@
log_aserror("Tried to set read-only property
NetStream.time");
);
}
+ return as_value();
}
// Both a getter and a (do-nothing) setter for bytesLoaded
-static void
+static as_value
netstream_bytesloaded(const fn_call& fn)
{
@@ -186,7 +192,7 @@
if ( fn.nargs == 0 )
{
- fn.result->set_double(ns->bytesLoaded());
+ return as_value(int(ns->bytesLoaded()));
}
else
{
@@ -194,10 +200,11 @@
log_aserror("Tried to set read-only property
NetStream.bytesLoaded");
);
}
+ return as_value();
}
// Both a getter and a (do-nothing) setter for bytesTotal
-static void
+static as_value
netstream_bytestotal(const fn_call& fn)
{
@@ -205,7 +212,7 @@
if ( fn.nargs == 0 )
{
- fn.result->set_double(ns->bytesTotal());
+ return as_value(int(ns->bytesTotal()));
}
else
{
@@ -213,6 +220,7 @@
log_aserror("Tried to set read-only property
NetStream.bytesTotal");
);
}
+ return as_value();
}
void
Index: server/asobj/Number.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Number.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/asobj/Number.cpp 4 Mar 2007 02:00:42 -0000 1.23
+++ server/asobj/Number.cpp 19 Mar 2007 17:11:14 -0000 1.24
@@ -14,7 +14,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: Number.cpp,v 1.23 2007/03/04 02:00:42 strk Exp $ */
+/* $Id: Number.cpp,v 1.24 2007/03/19 17:11:14 bjacques Exp $ */
// Implementation of ActionScript Number class.
@@ -52,7 +52,7 @@
// Forward declarations
static void number_val_to_str(double val, char *str);
-//static void number_to_string(const fn_call& fn);
+//static as_value number_to_string(const fn_call& fn);
static void
attachNumberInterface(as_object& o)
@@ -261,7 +261,7 @@
}
}
-static void
+static as_value
number_ctor(const fn_call& fn)
{
double val = 0;
@@ -272,7 +272,7 @@
number_as_object* obj = new number_as_object(val);
- fn.result->set_as_object(obj); // will keep alive
+ return as_value(obj); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/Object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Object.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/asobj/Object.cpp 16 Mar 2007 12:16:46 -0000 1.18
+++ server/asobj/Object.cpp 19 Mar 2007 17:11:14 -0000 1.19
@@ -18,7 +18,7 @@
//
//
-/* $Id: Object.cpp,v 1.18 2007/03/16 12:16:46 strk Exp $ */
+/* $Id: Object.cpp,v 1.19 2007/03/19 17:11:14 bjacques Exp $ */
// Implementation of ActionScript Object class.
@@ -42,13 +42,13 @@
namespace gnash {
// Forward declarations
-static void object_addproperty(const fn_call&);
-static void object_registerClass(const fn_call& fn);
-static void object_hasOwnProperty(const fn_call&);
-static void object_isPropertyEnumerable(const fn_call&);
-static void object_isPrototypeOf(const fn_call&);
-static void object_watch(const fn_call&);
-static void object_unwatch(const fn_call&);
+static as_value object_addproperty(const fn_call&);
+static as_value object_registerClass(const fn_call& fn);
+static as_value object_hasOwnProperty(const fn_call&);
+static as_value object_isPropertyEnumerable(const fn_call&);
+static as_value object_isPrototypeOf(const fn_call&);
+static as_value object_watch(const fn_call&);
+static as_value object_unwatch(const fn_call&);
static void
@@ -103,7 +103,7 @@
};
-static void
+static as_value
object_ctor(const fn_call& fn)
// Constructor for ActionScript class Object.
{
@@ -114,8 +114,7 @@
// WARNING: it is likely that fn.result and fn.arg(0)
// are the same location... so we might skip
// the set_as_object() call as a whole.
- fn.result->set_as_object(fn.arg(0).to_object());
- return;
+ return as_value(fn.arg(0).to_object());
}
boost::intrusive_ptr<as_object> new_obj;
@@ -129,7 +128,7 @@
new_obj = new object_as_object();
}
- fn.result->set_as_object(new_obj.get()); // will keep alive
+ return as_value(new_obj.get()); // will keep alive
}
std::auto_ptr<as_object>
@@ -159,7 +158,7 @@
}
-static void
+static as_value
object_addproperty(const fn_call& fn)
{
assert(fn.this_ptr);
@@ -179,8 +178,7 @@
// no need to abort here
if ( fn.nargs < 3 )
{
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
}
@@ -191,8 +189,7 @@
log_aserror("Invalid call to Object.addProperty() - "
"empty property name");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
as_function* getter = fn.arg(1).to_as_function();
@@ -202,8 +199,7 @@
log_aserror("Invalid call to Object.addProperty() - "
"getter is not an AS function");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
as_function* setter = fn.arg(2).to_as_function();
@@ -213,8 +209,7 @@
log_aserror("Invalid call to Object.addProperty() - "
"setter is not an AS function");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
@@ -224,10 +219,10 @@
bool result = obj->add_property(propname, *getter, *setter);
//log_warning("Object.addProperty(): testing");
- fn.result->set_bool(result);
+ return as_value(result);
}
-static void
+static as_value
object_registerClass(const fn_call& fn)
{
assert(fn.this_ptr);
@@ -247,8 +242,7 @@
// no need to abort here
if ( fn.nargs < 2 )
{
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
}
@@ -259,8 +253,7 @@
log_aserror("Invalid call to Object.registerClass() - "
"empty symbol id");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
as_function* theclass = fn.arg(1).to_as_function();
@@ -270,8 +263,7 @@
log_aserror("Invalid call to Object.registerClass() - "
"class is not a function");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
// Find the exported resource
@@ -288,8 +280,7 @@
symbolid.c_str(),
typeid(theclass).name());
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
// Check that the exported resource is a sprite_definition
@@ -309,24 +300,23 @@
typeid(theclass).name(),
typeid(*exp_res).name());
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
exp_clipdef->registerClass(theclass);
- fn.result->set_bool(true);
+ return as_value(true);
}
-void
+as_value
object_hasOwnProperty(const fn_call& fn)
{
- assert(fn.result->is_undefined());
+ //assert(fn.result->is_undefined());
if ( fn.nargs < 1 )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Object.hasOwnProperty() requires one arg");
);
- return;
+ return as_value();
}
as_value& arg = fn.arg(0);
std::string propname = arg.to_std_string();
@@ -335,21 +325,21 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Invalid call to Object.hasOwnProperty('%s')",
arg.to_string());
);
- return;
+ return as_value();
}
- fn.result->set_bool(fn.this_ptr->getOwnProperty(propname) != NULL);
+ return as_value(fn.this_ptr->getOwnProperty(propname) != NULL);
}
-void
+as_value
object_isPropertyEnumerable(const fn_call& fn)
{
- assert(fn.result->is_undefined());
+ //assert(fn.result->is_undefined());
if ( fn.nargs < 1 )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Object.isPropertyEnumerable() requires one arg");
);
- return;
+ return as_value();
}
as_value& arg = fn.arg(0);
std::string propname = arg.to_std_string();
@@ -358,30 +348,28 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Invalid call to
Object.isPropertyEnumerable('%s')", arg.to_string());
);
- return;
+ return as_value();
}
Property* prop = fn.this_ptr->getOwnProperty(propname);
if ( ! prop )
{
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
- fn.result->set_bool( ! prop->getFlags().get_dont_enum() );
+ return as_value( ! prop->getFlags().get_dont_enum() );
}
-void
+as_value
object_isPrototypeOf(const fn_call& fn)
{
- assert(fn.result->is_undefined());
+ //assert(fn.result->is_undefined());
if ( fn.nargs < 1 )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Object.isPrototypeOf() requires one arg");
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
as_object* obj = fn.arg(0).to_object();
@@ -390,15 +378,14 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("First arg to Object.isPrototypeOf(%s) is not an
object", fn.arg(0).to_string());
);
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
- fn.result->set_bool(fn.this_ptr->prototypeOf(*obj));
+ return as_value(fn.this_ptr->prototypeOf(*obj));
}
-void
+as_value
object_watch(const fn_call&)
{
static bool warned = false;
@@ -406,9 +393,10 @@
log_error("FIXME: %s unimplemented", __FUNCTION__);
warned=true;
}
+ return as_value();
}
-void
+as_value
object_unwatch(const fn_call&)
{
static bool warned = false;
@@ -416,6 +404,7 @@
log_error("FIXME: %s unimplemented", __FUNCTION__);
warned=true;
}
+ return as_value();
}
} // namespace gnash
Index: server/asobj/Selection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Selection.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/Selection.cpp 4 Mar 2007 02:00:42 -0000 1.6
+++ server/asobj/Selection.cpp 19 Mar 2007 17:11:14 -0000 1.7
@@ -29,15 +29,15 @@
namespace gnash {
-void selection_addlistener(const fn_call& fn);
-void selection_getbeginindex(const fn_call& fn);
-void selection_getcaretindex(const fn_call& fn);
-void selection_getendindex(const fn_call& fn);
-void selection_getfocus(const fn_call& fn);
-void selection_removelistener(const fn_call& fn);
-void selection_setfocus(const fn_call& fn);
-void selection_setselection(const fn_call& fn);
-void selection_ctor(const fn_call& fn);
+as_value selection_addlistener(const fn_call& fn);
+as_value selection_getbeginindex(const fn_call& fn);
+as_value selection_getcaretindex(const fn_call& fn);
+as_value selection_getendindex(const fn_call& fn);
+as_value selection_getfocus(const fn_call& fn);
+as_value selection_removelistener(const fn_call& fn);
+as_value selection_setfocus(const fn_call& fn);
+as_value selection_setselection(const fn_call& fn);
+as_value selection_ctor(const fn_call& fn);
static void
attachSelectionInterface(as_object& o)
@@ -81,37 +81,45 @@
//double get_numeric_value() const { return 0; }
};
-void selection_addlistener(const fn_call& /*fn*/) {
+as_value selection_addlistener(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void selection_getbeginindex(const fn_call& /*fn*/) {
+as_value selection_getbeginindex(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void selection_getcaretindex(const fn_call& /*fn*/) {
+as_value selection_getcaretindex(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void selection_getendindex(const fn_call& /*fn*/) {
+as_value selection_getendindex(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void selection_getfocus(const fn_call& /*fn*/) {
+as_value selection_getfocus(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void selection_removelistener(const fn_call& /*fn*/) {
+as_value selection_removelistener(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void selection_setfocus(const fn_call& /*fn*/) {
+as_value selection_setfocus(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void selection_setselection(const fn_call& /*fn*/) {
+as_value selection_setselection(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void
-selection_ctor(const fn_call& fn)
+as_value
+selection_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new selection_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/SharedObject.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SharedObject.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/SharedObject.cpp 4 Mar 2007 02:00:42 -0000 1.6
+++ server/asobj/SharedObject.cpp 19 Mar 2007 17:11:14 -0000 1.7
@@ -29,11 +29,11 @@
namespace gnash {
-void sharedobject_clear(const fn_call& fn);
-void sharedobject_flush(const fn_call& fn);
-void sharedobject_getlocal(const fn_call& fn);
-void sharedobject_getsize(const fn_call& fn);
-void sharedobject_ctor(const fn_call& fn);
+as_value sharedobject_clear(const fn_call& fn);
+as_value sharedobject_flush(const fn_call& fn);
+as_value sharedobject_getlocal(const fn_call& fn);
+as_value sharedobject_getsize(const fn_call& fn);
+as_value sharedobject_ctor(const fn_call& fn);
static void
attachSharedObjectInterface(as_object& o)
@@ -74,25 +74,29 @@
//double get_numeric_value() const { return 0; }
};
-void sharedobject_clear(const fn_call& /*fn*/) {
+as_value sharedobject_clear(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void sharedobject_flush(const fn_call& /*fn*/) {
+as_value sharedobject_flush(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void sharedobject_getlocal(const fn_call& /*fn*/) {
+as_value sharedobject_getlocal(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void sharedobject_getsize(const fn_call& /*fn*/) {
+as_value sharedobject_getsize(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void
-sharedobject_ctor(const fn_call& fn)
+as_value
+sharedobject_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new sharedobject_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/Sound.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Sound.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/Sound.cpp 9 Mar 2007 14:38:29 -0000 1.7
+++ server/asobj/Sound.cpp 19 Mar 2007 17:11:14 -0000 1.8
@@ -41,19 +41,19 @@
namespace gnash {
-static void sound_new(const fn_call& fn);
-static void sound_attachsound(const fn_call& fn);
-static void sound_getbytesloaded(const fn_call& fn);
-static void sound_getbytestotal(const fn_call& fn);
-static void sound_getpan(const fn_call& fn);
-static void sound_gettransform(const fn_call& fn);
-static void sound_getvolume(const fn_call& fn);
-static void sound_loadsound(const fn_call& fn);
-static void sound_setpan(const fn_call& fn);
-static void sound_settransform(const fn_call& fn);
-static void sound_setvolume(const fn_call& fn);
-static void sound_start(const fn_call& fn);
-static void sound_stop(const fn_call& fn);
+static as_value sound_new(const fn_call& fn);
+static as_value sound_attachsound(const fn_call& fn);
+static as_value sound_getbytesloaded(const fn_call& fn);
+static as_value sound_getbytestotal(const fn_call& fn);
+static as_value sound_getpan(const fn_call& fn);
+static as_value sound_gettransform(const fn_call& fn);
+static as_value sound_getvolume(const fn_call& fn);
+static as_value sound_loadsound(const fn_call& fn);
+static as_value sound_setpan(const fn_call& fn);
+static as_value sound_settransform(const fn_call& fn);
+static as_value sound_setvolume(const fn_call& fn);
+static as_value sound_start(const fn_call& fn);
+static as_value sound_stop(const fn_call& fn);
static as_object* getSoundInterface();
Sound::Sound() :
@@ -232,8 +232,8 @@
}
-void
-sound_new(const fn_call& fn)
+as_value
+sound_new(const fn_call& /* fn */)
{
Sound* sound_obj;
@@ -246,7 +246,7 @@
#else
sound_obj = new Sound();
#endif
- fn.result->set_as_object(sound_obj);
+ return as_value(sound_obj);
}
// Wrapper around dynamic_cast to implement user warning.
@@ -262,7 +262,7 @@
return ret;
}
-void
+as_value
sound_start(const fn_call& fn)
{
log_action("-- start sound");
@@ -282,10 +282,10 @@
}
}
so->start(secondOffset, loop);
-
+ return as_value();
}
-void
+as_value
sound_stop(const fn_call& fn)
{
log_action("-- stop sound ");
@@ -305,7 +305,7 @@
IF_VERBOSE_MALFORMED_SWF(
log_swferror("import error: resource '%s' is not exported",
name);
);
- return;
+ return as_value();
}
// FIXME: shouldn't we use dynamic_cast here (or rely on
sound_sample interface) ?
@@ -318,15 +318,15 @@
else
{
log_error("sound sample is NULL (doesn't cast to
sound_sample)");
- return;
+ return as_value();
}
}
so->stop(si);
-
+ return as_value();
}
-void
+as_value
sound_attachsound(const fn_call& fn)
{
log_action("-- attach sound");
@@ -335,7 +335,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("attach sound needs one argument");
);
- return;
+ return as_value();
}
Sound* so = ensure_sound(fn.this_ptr);
@@ -345,7 +345,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("attachSound need a non-null argument");
);
- return;
+ return as_value();
}
// check the import.
@@ -357,7 +357,7 @@
IF_VERBOSE_MALFORMED_SWF(
log_swferror("import error: resource '%s' is not exported",
name);
);
- return;
+ return as_value();
}
int si = 0;
@@ -370,15 +370,16 @@
else
{
log_error("sound sample is NULL (doesn't cast to
sound_sample)");
- return;
+ return as_value();
}
// sanity check
assert(si >= 0 && si < 1000);
so->attachSound(si, name);
+ return as_value();
}
-void
+as_value
sound_getbytesloaded(const fn_call& /*fn*/)
{
static bool warned = false;
@@ -387,9 +388,10 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void
+as_value
sound_getbytestotal(const fn_call& /*fn*/)
{
static bool warned = false;
@@ -398,9 +400,10 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void
+as_value
sound_getpan(const fn_call& /*fn*/)
{
static bool warned = false;
@@ -409,9 +412,10 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void
+as_value
sound_gettransform(const fn_call& /*fn*/)
{
static bool warned = false;
@@ -420,9 +424,10 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void
+as_value
sound_getvolume(const fn_call& fn)
{
@@ -430,27 +435,27 @@
int volume = so->getVolume();
- fn.result->set_int(volume);
+ return as_value(volume);
- return;
}
-void
+as_value
sound_loadsound(const fn_call& fn)
{
if (fn.nargs != 2) {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("loadSound needs 2 arguments!");
);
- return;
+ return as_value();
}
Sound* so = ensure_sound(fn.this_ptr);
so->loadSound(fn.arg(0).to_std_string(), fn.arg(1).to_bool());
+ return as_value();
}
-void
+as_value
sound_setpan(const fn_call& /*fn*/)
{
static bool warned = false;
@@ -459,9 +464,10 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void
+as_value
sound_settransform(const fn_call& /*fn*/)
{
static bool warned = false;
@@ -470,9 +476,10 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void
+as_value
sound_setvolume(const fn_call& fn)
{
if (fn.nargs < 1)
@@ -480,29 +487,31 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("set volume of sound needs one argument");
);
- return;
+ return as_value();
}
Sound* so = ensure_sound(fn.this_ptr);
int volume = (int) fn.arg(0).to_number();
so->setVolume(volume);
+ return as_value();
}
-void
+as_value
sound_duration(const fn_call& fn)
{
Sound* so = ensure_sound(fn.this_ptr);
if ( fn.nargs == 0 ) {
- fn.result->set_int(so->getDuration());
+ return as_value(so->getDuration());
} else {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Tried to set read-only property
Sound.duration");
);
}
+ return as_value();
}
-void
+as_value
sound_ID3(const fn_call& /*fn*/)
{
static bool warned = false;
@@ -511,19 +520,21 @@
log_warning("%s: unimplemented", __FUNCTION__);
warned = true;
}
+ return as_value();
}
-void
+as_value
sound_position(const fn_call& fn)
{
Sound* so = ensure_sound(fn.this_ptr);
if ( fn.nargs == 0 ) {
- fn.result->set_int(so->getPosition());
+ return as_value(so->getPosition());
} else {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Tried to set read-only property
Sound.position");
);
}
+ return as_value();
}
void
Index: server/asobj/Stage.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/Stage.cpp 4 Mar 2007 02:00:42 -0000 1.7
+++ server/asobj/Stage.cpp 19 Mar 2007 17:11:14 -0000 1.8
@@ -30,9 +30,9 @@
namespace gnash {
-void stage_addlistener(const fn_call& fn);
-void stage_removelistener(const fn_call& fn);
-void stage_ctor(const fn_call& fn);
+as_value stage_addlistener(const fn_call& fn);
+as_value stage_removelistener(const fn_call& fn);
+as_value stage_ctor(const fn_call& fn);
static void
attachStageInterface(as_object& o)
@@ -73,19 +73,21 @@
//double get_numeric_value() const { return 0; }
};
-void stage_addlistener(const fn_call& /*fn*/) {
+as_value stage_addlistener(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void stage_removelistener(const fn_call& /*fn*/) {
+as_value stage_removelistener(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void
-stage_ctor(const fn_call& fn)
+as_value
+stage_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new stage_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/System.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/System.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/asobj/System.cpp 15 Mar 2007 22:39:53 -0000 1.10
+++ server/asobj/System.cpp 19 Mar 2007 17:11:14 -0000 1.11
@@ -128,32 +128,37 @@
{
}
-void
-system_new(const fn_call& fn)
+as_value
+system_new(const fn_call& /* fn */)
{
system_as_object *system_obj = new system_as_object();
- fn.result->set_as_object(system_obj);
+ return as_value(system_obj);
}
-void system_security_allowdomain(const fn_call& /*fn*/) {
+as_value system_security_allowdomain(const fn_call& /*fn*/) {
log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
+ return as_value();
}
-void system_security_allowinsecuredomain(const fn_call& /*fn*/) {
+as_value system_security_allowinsecuredomain(const fn_call& /*fn*/) {
log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
+ return as_value();
}
-void system_security_loadpolicyfile(const fn_call& /*fn*/) {
+as_value system_security_loadpolicyfile(const fn_call& /*fn*/) {
log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
+ return as_value();
}
-void system_setclipboard(const fn_call& /*fn*/) {
+as_value system_setclipboard(const fn_call& /*fn*/) {
log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
+ return as_value();
}
-void system_showsettings(const fn_call& /*fn*/) {
+as_value system_showsettings(const fn_call& /*fn*/) {
log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
+ return as_value();
}
void
Index: server/asobj/System.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/System.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/System.h 15 Mar 2007 22:39:53 -0000 1.6
+++ server/asobj/System.h 19 Mar 2007 17:11:14 -0000 1.7
@@ -82,12 +82,12 @@
system_as_object();
};
-void system_new(const fn_call& fn);
-void system_security_allowdomain(const fn_call& fn);
-void system_security_allowinsecuredomain(const fn_call& fn);
-void system_security_loadpolicyfile(const fn_call& fn);
-void system_setclipboard(const fn_call& fn);
-void system_showsettings(const fn_call& fn);
+as_value system_new(const fn_call& fn);
+as_value system_security_allowdomain(const fn_call& fn);
+as_value system_security_allowinsecuredomain(const fn_call& fn);
+as_value system_security_loadpolicyfile(const fn_call& fn);
+as_value system_setclipboard(const fn_call& fn);
+as_value system_showsettings(const fn_call& fn);
void system_class_init(as_object& global);
Index: server/asobj/TextSnapshot.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/TextSnapshot.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/TextSnapshot.cpp 4 Mar 2007 02:00:42 -0000 1.6
+++ server/asobj/TextSnapshot.cpp 19 Mar 2007 17:11:14 -0000 1.7
@@ -29,15 +29,15 @@
namespace gnash {
-void textsnapshot_findtext(const fn_call& fn);
-void textsnapshot_getcount(const fn_call& fn);
-void textsnapshot_getselected(const fn_call& fn);
-void textsnapshot_getselectedtext(const fn_call& fn);
-void textsnapshot_gettext(const fn_call& fn);
-void textsnapshot_hittesttextnearpos(const fn_call& fn);
-void textsnapshot_setselectcolor(const fn_call& fn);
-void textsnapshot_setselected(const fn_call& fn);
-void textsnapshot_ctor(const fn_call& fn);
+as_value textsnapshot_findtext(const fn_call& fn);
+as_value textsnapshot_getcount(const fn_call& fn);
+as_value textsnapshot_getselected(const fn_call& fn);
+as_value textsnapshot_getselectedtext(const fn_call& fn);
+as_value textsnapshot_gettext(const fn_call& fn);
+as_value textsnapshot_hittesttextnearpos(const fn_call& fn);
+as_value textsnapshot_setselectcolor(const fn_call& fn);
+as_value textsnapshot_setselected(const fn_call& fn);
+as_value textsnapshot_ctor(const fn_call& fn);
static void
attachTextSnapshotInterface(as_object& o)
@@ -84,37 +84,45 @@
//double get_numeric_value() const { return 0; }
};
-void textsnapshot_findtext(const fn_call& /*fn*/) {
+as_value textsnapshot_findtext(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void textsnapshot_getcount(const fn_call& /*fn*/) {
+as_value textsnapshot_getcount(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void textsnapshot_getselected(const fn_call& /*fn*/) {
+as_value textsnapshot_getselected(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void textsnapshot_getselectedtext(const fn_call& /*fn*/) {
+as_value textsnapshot_getselectedtext(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void textsnapshot_gettext(const fn_call& /*fn*/) {
+as_value textsnapshot_gettext(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void textsnapshot_hittesttextnearpos(const fn_call& /*fn*/) {
+as_value textsnapshot_hittesttextnearpos(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void textsnapshot_setselectcolor(const fn_call& /*fn*/) {
+as_value textsnapshot_setselectcolor(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void textsnapshot_setselected(const fn_call& /*fn*/) {
+as_value textsnapshot_setselected(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void
-textsnapshot_ctor(const fn_call& fn)
+as_value
+textsnapshot_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new textsnapshot_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/Video.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Video.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/Video.cpp 4 Mar 2007 02:00:42 -0000 1.7
+++ server/asobj/Video.cpp 19 Mar 2007 17:11:14 -0000 1.8
@@ -29,9 +29,9 @@
namespace gnash {
-void video_attachvideo(const fn_call& fn);
-void video_clear(const fn_call& fn);
-void video_ctor(const fn_call& fn);
+as_value video_attachvideo(const fn_call& fn);
+as_value video_clear(const fn_call& fn);
+as_value video_ctor(const fn_call& fn);
static void
attachVideoInterface(as_object& o)
@@ -69,19 +69,21 @@
//double get_numeric_value() const { return 0; }
};
-void video_attachvideo(const fn_call& /*fn*/) {
+as_value video_attachvideo(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void video_clear(const fn_call& /*fn*/) {
+as_value video_clear(const fn_call& /*fn*/) {
log_warning("%s: unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void
-video_ctor(const fn_call& fn)
+as_value
+video_ctor(const fn_call& /* fn */)
{
boost::intrusive_ptr<as_object> obj = new video_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/gen-asclass.sh
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/gen-asclass.sh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/asobj/gen-asclass.sh 28 Feb 2007 23:08:35 -0000 1.9
+++ server/asobj/gen-asclass.sh 19 Mar 2007 17:11:14 -0000 1.10
@@ -220,24 +220,25 @@
# DO NOT CONVERT CASE, SWF7+ is case-sensitive
newi=`echo $i | sed -e 's/)//g'` # | tr '[A-Z]' '[a-z]'
cat <<EOF>>${srcname}
-static void
+static as_value
${lowname}_${newi}const fn_call& fn)
{
${lowname}_as_object* ptr = ensure_${lowname}(fn.this_ptr);
UNUSED(ptr);
log_warning("%s: unimplemented", __FUNCTION__);
+ return as_value();
}
EOF
done
cat <<EOF>>${srcname}
-void
+as_value
${lowname}_ctor(const fn_call& fn)
{
boost::intrusive_ptr<as_object> obj = new ${lowname}_as_object;
- fn.result->set_as_object(obj.get()); // will keep alive
+ return as_value(obj.get()); // will keep alive
}
// extern (used by Global.cpp)
Index: server/asobj/string.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/string.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/asobj/string.cpp 28 Feb 2007 10:52:38 -0000 1.18
+++ server/asobj/string.cpp 19 Mar 2007 17:11:14 -0000 1.19
@@ -14,7 +14,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: string.cpp,v 1.18 2007/02/28 10:52:38 strk Exp $ */
+/* $Id: string.cpp,v 1.19 2007/03/19 17:11:14 bjacques Exp $ */
// Implementation of ActionScript String class.
@@ -36,22 +36,22 @@
namespace gnash {
// Forward declarations
-static void string_get_length(const fn_call& fn);
-static void string_set_length(const fn_call& fn);
-static void string_concat(const fn_call& fn);
-static void string_slice(const fn_call& fn);
-static void string_split(const fn_call& fn);
-static void string_last_index_of(const fn_call& fn);
-static void string_sub_str(const fn_call& fn);
-static void string_sub_string(const fn_call& fn);
-static void string_index_of(const fn_call& fn);
-static void string_from_char_code(const fn_call& fn);
-static void string_char_code_at(const fn_call& fn);
-static void string_char_at(const fn_call& fn);
-static void string_to_upper_case(const fn_call& fn);
-static void string_to_lower_case(const fn_call& fn);
-static void string_to_string(const fn_call& fn);
-static void string_ctor(const fn_call& fn);
+static as_value string_get_length(const fn_call& fn);
+static as_value string_set_length(const fn_call& fn);
+static as_value string_concat(const fn_call& fn);
+static as_value string_slice(const fn_call& fn);
+static as_value string_split(const fn_call& fn);
+static as_value string_last_index_of(const fn_call& fn);
+static as_value string_sub_str(const fn_call& fn);
+static as_value string_sub_string(const fn_call& fn);
+static as_value string_index_of(const fn_call& fn);
+static as_value string_from_char_code(const fn_call& fn);
+static as_value string_char_code_at(const fn_call& fn);
+static as_value string_char_at(const fn_call& fn);
+static as_value string_to_upper_case(const fn_call& fn);
+static as_value string_to_lower_case(const fn_call& fn);
+static as_value string_to_string(const fn_call& fn);
+static as_value string_ctor(const fn_call& fn);
static void
attachStringInterface(as_object& o)
@@ -124,27 +124,26 @@
return ret;
}
-static void
+static as_value
string_get_length(const fn_call& fn)
{
tu_string_as_object* str = ensureString(fn.this_ptr);
- fn.result->set_int(str->m_string.utf8_length());
- return;
+ return as_value(str->m_string.utf8_length());
}
-static void
+static as_value
string_set_length(const fn_call& /*fn*/)
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("String: length property is read-only");
);
- return;
+ return as_value();
}
// all the arguments will be converted to string and concatenated
-static void
+static as_value
string_concat(const fn_call& fn)
{
tu_string_as_object* str = ensureString(fn.this_ptr);
@@ -152,11 +151,11 @@
int len = strlen(this_string.c_str());
int pos = len;
- for (int i = 0; i < fn.nargs; i++) len += strlen(fn.arg(i).to_string());
+ for (unsigned int i = 0; i < fn.nargs; i++) len +=
strlen(fn.arg(i).to_string());
char *newstr = new char[len + 1];
memcpy(newstr, this_string.c_str(),pos); // because pos at the moments
holds the strlen of this_string!
- for (int i = 0; i < fn.nargs; i++)
+ for (unsigned int i = 0; i < fn.nargs; i++)
{
int len = strlen(fn.arg(i).to_string());
memcpy((newstr + pos),fn.arg(i).to_string(),len);
@@ -165,12 +164,12 @@
newstr[len] = '\0';
tu_string returnstring(newstr);
- fn.result->set_tu_string(returnstring);
delete[] newstr; // because tu_string copies newstr
+ return as_value(returnstring);
}
// 1st param: start_index, 2nd param: end_index
-static void
+static as_value
string_slice(const fn_call& fn)
{
tu_string_as_object* str = ensureString(fn.this_ptr);
@@ -200,11 +199,10 @@
swap(&start, &end);
}
- fn.result->set_tu_string(this_string.utf8_substring(start, end));
- return;
+ return as_value(this_string.utf8_substring(start, end));
}
-static void
+static as_value
string_split(const fn_call& fn)
{
tu_string_as_object* str = ensureString(fn.this_ptr);
@@ -220,11 +218,8 @@
val.set_tu_string(this_string_ptr->m_string);
array->push(val);
- fn.result->set_as_object(array.get());
- return;
- }
-
- if (fn.nargs >= 1)
+ return as_value(array.get());
+ } else
{
tu_string this_string = this_string_ptr->m_string;
@@ -236,8 +231,7 @@
val.set_tu_string(this_string.utf8_substring(i,i+1));
array->push(val);
}
- fn.result->set_as_object(array.get());
- return;
+ return as_value(array.get());
}
else
{
@@ -267,30 +261,27 @@
pstart = pend + delimeter_len;
if (!(*pstart))
{
- fn.result->set_as_object(array.get());
- return;
+ return as_value(array.get());
}
pend = strstr(pstart,delimeter);
}
val.set_tu_string(tu_string(pstart));
array->push(val);
- fn.result->set_as_object(array.get());
- return;
+ return as_value(array.get());
}
}
}
-static void
+static as_value
string_last_index_of(const fn_call& fn)
{
tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
if (fn.nargs < 1)
{
- fn.result->set_double(-1);
- return;
+ return as_value(-1);
}
else
{
@@ -305,8 +296,7 @@
fn.arg(0).to_string());
if (p == NULL)
{
- fn.result->set_double(-1);
- return;
+ return as_value(-1);
}
const char* lastocc = p;
@@ -317,13 +307,12 @@
if (p) lastocc = p;
}
- fn.result->set_double(tu_string::utf8_char_count(str,
int(lastocc - str)));
- return;
+ return as_value(tu_string::utf8_char_count(str, int(lastocc -
str)));
}
}
// 1st param: start_index, 2nd param: length (NOT end_index)
-static void
+static as_value
string_sub_str(const fn_call& fn)
{
tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
@@ -345,12 +334,11 @@
end = iclamp(end, start, utf8_len);
}
- fn.result->set_tu_string(this_string.utf8_substring(start, end));
- return;
+ return as_value(this_string.utf8_substring(start, end));
}
// 1st param: start_index, 2nd param: end_index
-static void
+static as_value
string_sub_string(const fn_call& fn)
{
tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
@@ -372,19 +360,17 @@
if (end < start) swap(&start, &end); // dumb, but that's what the
docs say
- fn.result->set_tu_string(this_string.utf8_substring(start, end));
- return;
+ return as_value(this_string.utf8_substring(start, end));
}
-static void
+static as_value
string_index_of(const fn_call& fn)
{
tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
if (fn.nargs < 1)
{
- fn.result->set_double(-1);
- return;
+ return as_value(-1);
}
else
{
@@ -399,32 +385,30 @@
fn.arg(0).to_string());
if (p == NULL)
{
- fn.result->set_double(-1);
- return;
+ return as_value(-1);
}
- fn.result->set_double(tu_string::utf8_char_count(str, p - str));
- return;
+ return as_value(tu_string::utf8_char_count(str, p - str));
}
}
-static void
+static as_value
string_from_char_code(const fn_call& fn)
{
//tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
tu_string result;
- for (int i = 0; i < fn.nargs; i++)
+ for (unsigned int i = 0; i < fn.nargs; i++)
{
uint32 c = (uint32) fn.arg(i).to_number();
result.append_wide_char(c);
}
- fn.result->set_tu_string(result);
+ return as_value(result);
}
-static void
+static as_value
string_char_code_at(const fn_call& fn)
{
tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
@@ -434,8 +418,9 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("string.charCodeAt needs one argument");
)
- fn.result->set_nan(); // Same as for out-of-range arg
- return;
+ as_value rv;
+ rv.set_nan();
+ return rv; // Same as for out-of-range arg
}
IF_VERBOSE_ASCODING_ERRORS(
if (fn.nargs > 1)
@@ -445,16 +430,14 @@
int index = static_cast<int>(fn.arg(0).to_number());
if (index >= 0 && index < this_string_ptr->m_string.utf8_length())
{
-
fn.result->set_double(this_string_ptr->m_string.utf8_char_at(index));
- return;
+ return as_value(this_string_ptr->m_string.utf8_char_at(index));
}
double temp = 0.0; // This variable will let us divide by zero
without a compiler warning
- fn.result->set_double(temp/temp); // this division by zero
creates a NaN value
- return;
+ return as_value(temp/temp); // this division by zero creates a NaN
value
}
-static void
+static as_value
string_char_at(const fn_call& fn)
{
tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
@@ -464,8 +447,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("%s needs one argument", __FUNCTION__);
)
- fn.result->set_tu_string(""); // Same as for out-of-range arg
- return;
+ return as_value(""); // Same as for out-of-range arg
}
IF_VERBOSE_ASCODING_ERRORS(
if (fn.nargs > 1)
@@ -477,42 +459,38 @@
{
tu_string result;
result += this_string_ptr->m_string.utf8_char_at(index);
- fn.result->set_tu_string(result);
- return;
+ return as_value(result);
}
double temp = 0.0; // This variable will let us divide by zero
without a compiler warning
- fn.result->set_double(temp/temp); // this division by zero
creates a NaN value
- return;
+ return as_value(temp/temp); // this division by zero creates a NaN
value
}
-static void
+static as_value
string_to_upper_case(const fn_call& fn)
{
tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
- fn.result->set_tu_string(this_string_ptr->m_string.utf8_to_upper());
- return;
+ return as_value(this_string_ptr->m_string.utf8_to_upper());
}
-static void
+static as_value
string_to_lower_case(const fn_call& fn)
{
tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
- fn.result->set_tu_string(this_string_ptr->m_string.utf8_to_lower());
- return;
+ return as_value(this_string_ptr->m_string.utf8_to_lower());
}
-static void
+static as_value
string_to_string(const fn_call& fn)
{
tu_string_as_object* this_string_ptr = ensureString(fn.this_ptr);
- fn.result->set_tu_string(this_string_ptr->m_string);
+ return as_value(this_string_ptr->m_string);
}
-static void
+static as_value
string_ctor(const fn_call& fn)
{
boost::intrusive_ptr<tu_string_as_object> str = new tu_string_as_object;
@@ -525,7 +503,7 @@
// this shouldn't be needed
//attachStringInterface(*str);
- fn.result->set_as_object(str.get());
+ return as_value(str.get());
}
// extern (used by Global.cpp)
Index: server/asobj/xml.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/asobj/xml.cpp 9 Mar 2007 13:34:39 -0000 1.19
+++ server/asobj/xml.cpp 19 Mar 2007 17:11:14 -0000 1.20
@@ -14,7 +14,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: xml.cpp,v 1.19 2007/03/09 13:34:39 strk Exp $ */
+/* $Id: xml.cpp,v 1.20 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -51,34 +51,34 @@
static as_object* getXMLInterface();
-DSOEXPORT void xml_new(const fn_call& fn);
-static void xml_load(const fn_call& fn);
-static void xml_set_current(const fn_call& fn);
-
-static void xml_addrequestheader(const fn_call& fn);
-static void xml_appendchild(const fn_call& fn);
-static void xml_clonenode(const fn_call& fn);
-static void xml_createelement(const fn_call& fn);
-static void xml_createtextnode(const fn_call& fn);
-static void xml_getbytesloaded(const fn_call& fn);
-static void xml_getbytestotal(const fn_call& fn);
-static void xml_haschildnodes(const fn_call& fn);
-static void xml_insertbefore(const fn_call& fn);
-static void xml_parsexml(const fn_call& fn);
-static void xml_removenode(const fn_call& fn);
-static void xml_send(const fn_call& fn);
-static void xml_sendandload(const fn_call& fn);
-static void xml_tostring(const fn_call& fn);
-static void xml_firstchild(const fn_call& fn);
-static void xml_childnodes(const fn_call& fn);
+DSOEXPORT as_value xml_new(const fn_call& fn);
+static as_value xml_load(const fn_call& fn);
+static as_value xml_set_current(const fn_call& fn);
+
+static as_value xml_addrequestheader(const fn_call& fn);
+static as_value xml_appendchild(const fn_call& fn);
+static as_value xml_clonenode(const fn_call& fn);
+static as_value xml_createelement(const fn_call& fn);
+static as_value xml_createtextnode(const fn_call& fn);
+static as_value xml_getbytesloaded(const fn_call& fn);
+static as_value xml_getbytestotal(const fn_call& fn);
+static as_value xml_haschildnodes(const fn_call& fn);
+static as_value xml_insertbefore(const fn_call& fn);
+static as_value xml_parsexml(const fn_call& fn);
+static as_value xml_removenode(const fn_call& fn);
+static as_value xml_send(const fn_call& fn);
+static as_value xml_sendandload(const fn_call& fn);
+static as_value xml_tostring(const fn_call& fn);
+static as_value xml_firstchild(const fn_call& fn);
+static as_value xml_childnodes(const fn_call& fn);
// These are the event handlers called for this object
-static void xml_ondata(const fn_call& fn);
-static void xml_loaded(const fn_call& fn);
+static as_value xml_ondata(const fn_call& fn);
+static as_value xml_loaded(const fn_call& fn);
// Properties
-static void xml_nodename(const fn_call& fn);
-static void xml_nodevalue(const fn_call& fn);
+static as_value xml_nodename(const fn_call& fn);
+static as_value xml_nodevalue(const fn_call& fn);
static LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
#ifdef USE_DEBUGGER
@@ -757,11 +757,12 @@
// Callbacks. These are the wrappers for the C++ functions so they'll work as
// callbacks from within gnash.
//
-void
+as_value
xml_load(const fn_call& fn)
{
as_value method;
as_value val;
+ as_value rv = false;
bool ret;
struct stat stats;
@@ -774,17 +775,17 @@
// If the file doesn't exist, don't try to do anything.
if (stat(filespec.c_str(), &stats) < 0) {
fprintf(stderr, "ERROR: doesn't exist.%s\n", filespec.c_str());
- fn.result->set_bool(false);
- return;
+ rv = false;
+ return rv;
}
// Set the argument to the function event handler based on whether the load
// was successful or failed.
ret = xml_obj->load(filespec.c_str());
- fn.result->set_bool(ret);
+ rv = ret;
if (ret == false) {
- return;
+ return rv;
}
//env->bottom(first_arg) = ret;
@@ -813,7 +814,8 @@
if (as_function* as_func = method.to_as_function()) {
// It's an ActionScript function. Call it.
log_msg("Calling ActionScript function for onLoad\n");
- (*as_func)(fn_call(&val, xml_obj, fn.env, fn.nargs,
fn.first_arg_bottom_index)); // was this_ptr instead of node
+ // XXX other than being assigned into, val appears to be unused.
+ val = (*as_func)(fn_call(xml_obj, fn.env, fn.nargs,
fn.first_arg_bottom_index)); // was this_ptr instead of node
} else {
log_error("error in call_method(): method is not a function\n");
}
@@ -826,12 +828,13 @@
#endif
- fn.result->set_bool(true);
+ rv = true;
+ return rv;
}
// This executes the event handler for XML::XML_LOAD if it's been defined,
// and the XML file has loaded sucessfully.
-void
+as_value
xml_onload(const fn_call& fn)
{
//log_msg("%s:\n", __FUNCTION__);
@@ -861,11 +864,11 @@
}
}
- fn.result->set_bool(val.to_bool());
+ return as_value(val.to_bool());
}
// This is the default event handler, and is usually redefined in the SWF
script
-void
+as_value
xml_ondata(const fn_call& fn)
{
log_msg("%s:\n", __FUNCTION__);
@@ -889,7 +892,7 @@
}
//fn.result->set(&val);
- fn.result->set_bool(val.to_bool());
+ return as_value(val.to_bool());
}
void
@@ -942,7 +945,7 @@
return o.get();
}
-void
+as_value
xml_new(const fn_call& fn)
{
as_value inum;
@@ -968,15 +971,14 @@
XML* xml_obj = (XML*)obj;
//log_msg("\tCloned the XML object at %p\n", xml_obj);
//result->set(xml_obj);
- fn.result->set_as_object(xml_obj);
- return;
+ return as_value(xml_obj);
}
} else {
xml_obj = new XML;
//log_msg("\tCreated New XML object at %p\n", xml_obj);
}
- fn.result->set_as_object(xml_obj);
+ return as_value(xml_obj);
}
//
@@ -987,7 +989,7 @@
// determines whether the document-loading process initiated by the XML.load()
// call has completed. If the process completes successfully, the method
// returns true; otherwise, it returns false.
-void
+as_value
xml_loaded(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -1000,22 +1002,23 @@
assert(ptr);
std::string filespec = fn.arg(0).to_string();
//fn.result->set(ptr->loaded());
- fn.result->set_bool(ptr->loaded());
+ return as_value(ptr->loaded());
}
-void xml_addrequestheader(const fn_call& fn)
+as_value xml_addrequestheader(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
XML *ptr = (XML*)fn.this_ptr;
assert(ptr);
-// fn.result->set_int(ptr->getAllocated());
+// return as_value(ptr->getAllocated());
// ptr->addRequestHeader();
log_msg("%s:unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void xml_appendchild(const fn_call& fn)
+as_value xml_appendchild(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
// log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
@@ -1031,9 +1034,10 @@
} else {
log_msg("ERROR: no child XMLNode paramaters!\\n");
}
+ return as_value();
}
-void xml_clonenode(const fn_call& fn)
+as_value xml_clonenode(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
// log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
@@ -1045,11 +1049,12 @@
bool deep = fn.arg(0).to_bool();
xml_obj = new XMLNode;
ptr->cloneNode(*xml_obj, deep);
- fn.result->set_as_object(xml_obj);
+ return as_value(xml_obj);
} else {
log_msg("ERROR: no Depth paramater!\n");
}
+ return as_value();
}
/// \brief create a new XML element
@@ -1061,7 +1066,7 @@
/// the XML.createTextNode() method are the constructor methods for
/// creating nodes for an XML object.
-void xml_createelement(const fn_call& fn)
+as_value xml_createelement(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -1076,11 +1081,12 @@
xml_obj->nodeTypeSet(XML_ELEMENT_NODE);
// ptr->set_member(text, xml_obj); // FIXME: use a getter/setter !
// no return code from this method
- fn.result->set_as_object(xml_obj);
+ return as_value(xml_obj);
} else {
log_msg("ERROR: no text for element creation!\n");
}
+ return as_value();
}
/// \brief Create a new XML node
@@ -1092,7 +1098,7 @@
/// XML.createElement() method are the constructor methods for
/// creating nodes for an XML object.
-void xml_createtextnode(const fn_call& fn)
+as_value xml_createtextnode(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -1107,33 +1113,34 @@
xml_obj = new XMLNode;
xml_obj->nodeValueSet(text);
xml_obj->nodeTypeSet(XML_TEXT_NODE);
- fn.result->set_as_object(xml_obj);
+ return as_value(xml_obj);
// log_msg("%s: xml obj is %p\n", __PRETTY_FUNCTION__, xml_obj);
} else {
log_msg("ERROR: no text for text node creation!\n");
}
+ return as_value();
}
-void xml_getbytesloaded(const fn_call& fn)
+as_value xml_getbytesloaded(const fn_call& fn)
{
XML *ptr = (XML*)fn.this_ptr;
assert(ptr);
- fn.result->set_int(ptr->getBytesLoaded());
+ return as_value(ptr->getBytesLoaded());
}
-void xml_getbytestotal(const fn_call& fn)
+as_value xml_getbytestotal(const fn_call& fn)
{
XML *ptr = (XML*)fn.this_ptr;
assert(ptr);
- fn.result->set_int(ptr->getBytesTotal());
+ return as_value(ptr->getBytesTotal());
}
-void xml_haschildnodes(const fn_call& fn)
+as_value xml_haschildnodes(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
XML *ptr = (XML*)fn.this_ptr;
assert(ptr);
- fn.result->set_bool(ptr->hasChildNodes());
+ return as_value(ptr->hasChildNodes());
}
/// \brief insert a node before a node
@@ -1144,18 +1151,19 @@
/// method. If beforeNode is not a child of my_xml, the insertion
/// fails.
-void xml_insertbefore(const fn_call& fn)
+as_value xml_insertbefore(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
XML *ptr = (XML*)fn.this_ptr;
assert(ptr);
-// fn.result->set_int(ptr->getAllocated());
+// return as_value(ptr->getAllocated());
// ptr->insertBefore();
log_msg("%s:unimplemented \n", __FUNCTION__);
+ return as_value();
}
-void xml_parsexml(const fn_call& fn)
+as_value xml_parsexml(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
const char *text;
@@ -1184,40 +1192,44 @@
#else
#endif
-// fn.result->set_int(ptr->getAllocated());
+ return as_value();
+// return as_value(ptr->getAllocated());
}
/// \brief removes the specified XML object from its parent. Also
/// deletes all descendants of the node.
-void xml_removenode(const fn_call& fn)
+as_value xml_removenode(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
XML *ptr = (XML*)fn.this_ptr;
assert(ptr);
-// fn.result->set_int(ptr->getAllocated());
+// return as_value(ptr->getAllocated());
ptr->removeNode();
+ return as_value();
}
-void xml_send(const fn_call& fn)
+as_value xml_send(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
XML *ptr = (XML*)fn.this_ptr;
assert(ptr);
-// fn.result->set_int(ptr->getAllocated());
+// return as_value(ptr->getAllocated());
ptr->send();
+ return as_value();
}
-void xml_sendandload(const fn_call& fn)
+as_value xml_sendandload(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
XML *ptr = (XML*)fn.this_ptr;
assert(ptr);
-// fn.result->set_int(ptr->getAllocated());
+// return as_value(ptr->getAllocated());
ptr->sendAndLoad();
+ return as_value();
}
-void xml_tostring(const fn_call& fn)
+as_value xml_tostring(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
XML *ptr = (XML*)fn.this_ptr;
@@ -1228,11 +1240,11 @@
string str = ptr->toString();
// cerr << "AAAAHHHHH: " << str << endl;
- fn.result->set_string(str.c_str());
+ return as_value(str.c_str());
}
// Both a getter and a setter for nodeName
-static void
+static as_value
xml_nodename(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -1242,17 +1254,18 @@
if ( fn.nargs == 0 ) {
const char* val = ptr->nodeName();
if ( val ) {
- fn.result->set_string(val);
+ return as_value(val);
} else {
- fn.result->set_null();
+ return as_value();
}
} else {
ptr->nodeNameSet(fn.arg(0).to_string());
}
+ return as_value();
}
// Both a getter and a setter for nodeValue
-static void
+static as_value
xml_nodevalue(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -1265,18 +1278,19 @@
//log_msg(" nodeValue() returns '%s'", ptr->nodeValue());
const char* val = ptr->nodeValue();
if ( val ) {
- fn.result->set_string(val);
+ return as_value(val);
} else {
- fn.result->set_null();
+ return as_value();
}
} else {
//log_msg(" arg(0) == '%s'", fn.arg(0).to_string());
ptr->nodeValueSet(fn.arg(0).to_string());
}
+ return as_value();
}
// Both a getter and a (do-nothing) setter for firstChild
-static void
+static as_value
xml_firstchild(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -1284,17 +1298,18 @@
XML *ptr = static_cast<XML*>(fn.this_ptr);
if ( fn.nargs == 0 ) {
- //fn.result->set_as_object(ptr->firstChild());
- fn.result->set_as_object(ptr);
+ //return as_value(ptr->firstChild());
+ return as_value(ptr);
} else {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Tried to set read-only property XML.firstChild");
);
}
+ return as_value();
}
// Both a getter and a (do-nothing) setter for childNodes
-static void
+static as_value
xml_childnodes(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -1302,13 +1317,14 @@
XML *ptr = static_cast<XML*>(fn.this_ptr);
if ( fn.nargs == 0 ) {
- //fn.result->set_as_object(ptr->childNodes());
- fn.result->set_as_object(ptr);
+ //return as_value(ptr->childNodes());
+ return as_value(ptr);
} else {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Tried to set read-only property XML.childNodes");
);
}
+ return as_value();
}
int
Index: server/asobj/xml.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/xml.h 3 Mar 2007 16:35:11 -0000 1.7
+++ server/asobj/xml.h 19 Mar 2007 17:11:14 -0000 1.8
@@ -192,7 +192,7 @@
// Exporting this is a temporary hack for not changing xmlsocket.cpp now
// (xmlsocket_xml_new calls xml_new)
-DSOEXPORT void xml_new(const fn_call& fn);
+DSOEXPORT as_value xml_new(const fn_call& fn);
DSOEXPORT int memadjust(int x);
Index: server/asobj/xmlnode.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlnode.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/asobj/xmlnode.cpp 9 Mar 2007 13:39:34 -0000 1.16
+++ server/asobj/xmlnode.cpp 19 Mar 2007 17:11:14 -0000 1.17
@@ -14,7 +14,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: xmlnode.cpp,v 1.16 2007/03/09 13:39:34 strk Exp $ */
+/* $Id: xmlnode.cpp,v 1.17 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -48,21 +48,21 @@
namespace gnash {
-static void xmlnode_new(const fn_call& fn);
-static void xmlnode_nodename(const fn_call& fn);
-static void xmlnode_nodevalue(const fn_call& fn);
-static void xmlnode_nodetype(const fn_call& fn);
-static void xmlnode_appendchild(const fn_call& fn);
-static void xmlnode_clonenode(const fn_call& fn);
-static void xmlnode_haschildnodes(const fn_call& fn);
-static void xmlnode_insertbefore(const fn_call& fn);
-static void xmlnode_removenode(const fn_call& fn);
-static void xmlnode_tostring(const fn_call& fn);
-static void xmlnode_nodename(const fn_call& fn);
-static void xmlnode_firstchild(const fn_call& fn);
-static void xmlnode_lastchild(const fn_call& fn);
-static void xmlnode_nextsibling(const fn_call& fn);
-static void xmlnode_previoussibling(const fn_call& fn);
+static as_value xmlnode_new(const fn_call& fn);
+static as_value xmlnode_nodename(const fn_call& fn);
+static as_value xmlnode_nodevalue(const fn_call& fn);
+static as_value xmlnode_nodetype(const fn_call& fn);
+static as_value xmlnode_appendchild(const fn_call& fn);
+static as_value xmlnode_clonenode(const fn_call& fn);
+static as_value xmlnode_haschildnodes(const fn_call& fn);
+static as_value xmlnode_insertbefore(const fn_call& fn);
+static as_value xmlnode_removenode(const fn_call& fn);
+static as_value xmlnode_tostring(const fn_call& fn);
+static as_value xmlnode_nodename(const fn_call& fn);
+static as_value xmlnode_firstchild(const fn_call& fn);
+static as_value xmlnode_lastchild(const fn_call& fn);
+static as_value xmlnode_nextsibling(const fn_call& fn);
+static as_value xmlnode_previoussibling(const fn_call& fn);
static as_object* getXMLNodeInterface();
static LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
@@ -471,7 +471,7 @@
return o.get();
}
-static void
+static as_value
xmlnode_new(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -485,10 +485,10 @@
}
}
- fn.result->set_as_object(xml_obj);
+ return as_value(xml_obj);
}
-static void
+static as_value
xmlnode_appendchild(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -519,9 +519,10 @@
} else {
log_msg("ERROR: no child XMLNode paramaters!\\n");
}
+ return as_value();
}
-static void
+static as_value
xmlnode_clonenode(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -534,37 +535,41 @@
bool deep = fn.arg(0).to_bool();
xmlnode_obj = new XMLNode;
ptr->cloneNode(*xmlnode_obj, deep);
- fn.result->set_as_object(xmlnode_obj);
+ return as_value(xmlnode_obj);
} else {
log_msg("ERROR: no Depth paramater!\n");
}
+ return as_value();
}
-static void
+static as_value
xmlnode_insertbefore(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
XMLNode *ptr = (XMLNode*)fn.this_ptr;
assert(ptr);
-// fn.result->set_int(ptr->obj.getAllocated());
+// return as_value(ptr->obj.getAllocated());
// ptr->obj.insertBefore();
log_msg("%s:unimplemented \n", __PRETTY_FUNCTION__);
+ return as_value();
}
-static void
+
+static as_value
xmlnode_removenode(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
XMLNode *ptr = (XMLNode*)fn.this_ptr;
assert(ptr);
-// fn.result->set_int(ptr->obj.getAllocated());
+// return as_value(ptr->obj.getAllocated());
ptr->removeNode();
+ return as_value();
}
// TODO: shouldn't overriding get_text_value() be fine ?
-static void
+static as_value
xmlnode_tostring(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -572,64 +577,66 @@
XMLNode *ptr = (XMLNode*)fn.this_ptr;
assert(ptr);
- fn.result->set_string(ptr->toString());
+ return as_value(ptr->toString());
}
-static void
+static as_value
xmlnode_haschildnodes(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
XMLNode *ptr = (XMLNode*)fn.this_ptr;
assert(ptr);
- fn.result->set_bool(ptr->hasChildNodes());
+ return as_value(ptr->hasChildNodes());
}
// Both a getter and a setter for nodeValue
-static void
+static as_value
xmlnode_nodevalue(const fn_call& fn)
{
//GNASH_REPORT_FUNCTION;
assert(dynamic_cast<XMLNode*>(fn.this_ptr));
XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
+ as_value rv;
+ rv.set_null();
//log_msg("xmlnode_nodevalue called with %d args against 'this' = %p",
fn.nargs, ptr);
if ( fn.nargs == 0 ) {
//log_msg(" nodeValue() returns '%s'", ptr->nodeValue());
const char* val = ptr->nodeValue();
if ( val ) {
- fn.result->set_string(val);
- } else {
- fn.result->set_null();
+ rv = val;
}
} else {
//log_msg(" arg(0) == '%s'", fn.arg(0).to_string());
ptr->nodeValueSet(fn.arg(0).to_string());
}
+ return rv;
}
// Both a getter and a setter for nodeName
-static void
+static as_value
xmlnode_nodename(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
assert(dynamic_cast<XMLNode*>(fn.this_ptr));
XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
+ as_value rv;
+ rv.set_null();
if ( fn.nargs == 0 ) {
const char* val = ptr->nodeName();
if ( val ) {
- fn.result->set_string(val);
- } else {
- fn.result->set_null();
+ rv = val;
}
} else {
ptr->nodeNameSet(fn.arg(0).to_string());
}
+ return rv;
}
// Both a getter and a (do-nothing) setter for nodeType
-static void
+static as_value
xmlnode_nodetype(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -638,29 +645,30 @@
XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
if ( fn.nargs == 0 ) {
- fn.result->set_int(ptr->nodeType());
+ return as_value(ptr->nodeType());
} else {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Tried to set read-only property XMLNode.nodeType");
);
}
+ return as_value();
}
// Both a getter and a (do-nothing) setter for firstChild
-static void
+static as_value
xmlnode_firstchild(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
assert(dynamic_cast<XMLNode*>(fn.this_ptr));
XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
+ as_value rv;
+ rv.set_null();
if ( fn.nargs == 0 )
{
XMLNode *node = ptr->firstChild();
- if (node == NULL) {
- fn.result->set_null();
- } else {
- fn.result->set_as_object(node);
+ if (node) {
+ rv = node;
}
}
else
@@ -670,78 +678,82 @@
);
}
+ return rv;
}
// Both a getter and a (do-nothing) setter for lastChild
-static void
+static as_value
xmlnode_lastchild(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
assert(dynamic_cast<XMLNode*>(fn.this_ptr));
XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
+ as_value rv;
+ rv.set_null();
if ( fn.nargs != 0 )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Tried to set read-only property XMLNode.lastChild");
);
- return;
+ return rv;
}
XMLNode *node = ptr->lastChild();
- if (node == NULL) {
- fn.result->set_null();
- } else {
- fn.result->set_as_object(node);
+ if (node) {
+ rv = node;
}
+ return rv;
}
// Both a getter and a (do-nothing) setter for nextSibling
-static void
+static as_value
xmlnode_nextsibling(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
+ as_value rv;
+ rv.set_null();
if ( fn.nargs != 0 )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Tried to set read-only property XMLNode.nextSibling");
);
- return;
+ return rv;
}
assert(dynamic_cast<XMLNode*>(fn.this_ptr));
XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
XMLNode *node = ptr->nextSibling();
- if (node == NULL) {
- fn.result->set_null();
- } else {
- fn.result->set_as_object(node);
+ if (node) {
+ rv = node;
}
+ return rv;
}
// Both a getter and a (do-nothing) setter for previousSibling
-static void
+static as_value
xmlnode_previoussibling(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
+ as_value rv;
+ rv.set_null();
if ( fn.nargs != 0 )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Tried to set read-only property XMLNode.previousSibling");
);
- return;
+ return rv;
}
assert(dynamic_cast<XMLNode*>(fn.this_ptr));
XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
XMLNode *node = ptr->previousSibling();
- if (node == NULL) {
- fn.result->set_null();
- } else {
- fn.result->set_as_object(node);
+ if (node) {
+ rv = node;
}
+ return rv;
}
// extern (used by Global.cpp)
Index: server/asobj/xmlsocket.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlsocket.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/asobj/xmlsocket.cpp 9 Mar 2007 13:55:50 -0000 1.9
+++ server/asobj/xmlsocket.cpp 19 Mar 2007 17:11:14 -0000 1.10
@@ -365,7 +365,7 @@
return ret;
}
-void
+as_value
xmlsocket_connect(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -374,8 +374,7 @@
static bool first = true; // This event handler should only be
executed once.
if (!first) {
- fn.result->set_bool(true);
- return;
+ return as_value(true);
}
log_msg("%s: nargs=%d\n", __FUNCTION__, fn.nargs);
@@ -416,11 +415,11 @@
fn.env->pop();
- fn.result->set_bool(true);
+ return as_value(true);
}
-void
+as_value
xmlsocket_send(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -431,10 +430,10 @@
assert(ptr);
const std::string object = fn.env->bottom(
fn.first_arg_bottom_index).to_string();
// log_msg("%s: host=%s, port=%g\n", __FUNCTION__, host, port);
- fn.result->set_bool(ptr->obj.send(object));
+ return as_value(ptr->obj.send(object));
}
-void
+as_value
xmlsocket_close(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -446,19 +445,21 @@
// Since the return code from close() doesn't get used by Shockwave,
// we don't care either.
ptr->obj.close();
+ return as_value();
}
-void
+as_value
xmlsocket_xml_new(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
//log_msg("%s: nargs=%d\n", __FUNCTION__, nargs);
xml_new(fn);
+ return as_value();
}
-void
-xmlsocket_new(const fn_call& fn)
+as_value
+xmlsocket_new(const fn_call& /* fn */)
{
GNASH_REPORT_FUNCTION;
//log_msg("%s: nargs=%d\n", __FUNCTION__, nargs);
@@ -509,7 +510,7 @@
#endif
#endif
- fn.result->set_bool(xmlsock_obj);
+ return as_value(xmlsock_obj);
// Tune malloc for the best performance
//mallopt(M_MMAP_MAX,0);
@@ -519,7 +520,7 @@
}
-void
+as_value
xmlsocket_event_ondata(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -535,8 +536,7 @@
assert(ptr);
if (ptr->obj.processingData()) {
log_msg("Still processing data!\n");
- fn.result->set_bool(false);
- return;
+ return as_value(false);
}
memset(messages, 0, sizeof(char *)*200);
@@ -584,10 +584,10 @@
//malloc_trim(0);
//result->set(&data);
- fn.result->set_bool(true);
+ return as_value(true);
}
-void
+as_value
xmlsocket_event_close(const fn_call& /* fn */)
{
#if 0
@@ -598,9 +598,10 @@
#else
log_error("%s: unimplemented!\n", __FUNCTION__);
#endif
+ return as_value();
}
-void
+as_value
xmlsocket_event_connect(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
@@ -609,8 +610,7 @@
static bool first = true; // This event handler should only be
executed once.
if (!first) {
- fn.result->set_bool(true);
- return;
+ return as_value(true);
}
xmlsocket_as_object* ptr = (xmlsocket_as_object*) (as_object*)
fn.this_ptr;
@@ -629,9 +629,9 @@
}
}
- fn.result->set_bool(val.to_bool());
+ return as_value(val.to_bool());
}
-void
+as_value
xmlsocket_event_xml(const fn_call& /* fn */)
{
GNASH_REPORT_FUNCTION;
@@ -643,6 +643,7 @@
#else
log_error("%s: unimplemented!\n", __FUNCTION__);
#endif
+ return as_value();
}
static XMLSocket xs;
Index: server/asobj/xmlsocket.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlsocket.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/xmlsocket.h 13 Feb 2007 19:36:34 -0000 1.4
+++ server/asobj/xmlsocket.h 19 Mar 2007 17:11:14 -0000 1.5
@@ -89,17 +89,17 @@
XMLSocket obj;
};
-DSOEXPORT void xmlsocket_connect(const fn_call& fn);
-DSOEXPORT void xmlsocket_send(const fn_call& fn);
-DSOEXPORT void xmlsocket_xml_new(const fn_call& fn);
-DSOEXPORT void xmlsocket_new(const fn_call& fn);
-DSOEXPORT void xmlsocket_close(const fn_call& fn);
+DSOEXPORT as_value xmlsocket_connect(const fn_call& fn);
+DSOEXPORT as_value xmlsocket_send(const fn_call& fn);
+DSOEXPORT as_value xmlsocket_xml_new(const fn_call& fn);
+DSOEXPORT as_value xmlsocket_new(const fn_call& fn);
+DSOEXPORT as_value xmlsocket_close(const fn_call& fn);
// These are the event handlers called for this object
-DSOEXPORT void xmlsocket_event_ondata(const fn_call& fn);
-DSOEXPORT void xmlsocket_event_close(const fn_call& fn);
-DSOEXPORT void xmlsocket_event_connect(const fn_call& fn);
-DSOEXPORT void xmlsocket_event_xml(const fn_call& fn);
+DSOEXPORT as_value xmlsocket_event_ondata(const fn_call& fn);
+DSOEXPORT as_value xmlsocket_event_close(const fn_call& fn);
+DSOEXPORT as_value xmlsocket_event_connect(const fn_call& fn);
+DSOEXPORT as_value xmlsocket_event_xml(const fn_call& fn);
DSOEXPORT int check_sockets(int fd);
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- server/vm/ASHandlers.cpp 17 Mar 2007 22:04:32 -0000 1.65
+++ server/vm/ASHandlers.cpp 19 Mar 2007 17:11:14 -0000 1.66
@@ -14,7 +14,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: ASHandlers.cpp,v 1.65 2007/03/17 22:04:32 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.66 2007/03/19 17:11:14 bjacques Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -110,8 +110,8 @@
log_action("it's a built-in class");
);
- fn_call call(&new_obj, NULL, &env, nargs, first_arg_index);
- (*ctor_as_func)(call);
+ fn_call call(NULL, &env, nargs, first_arg_index);
+ new_obj = (*ctor_as_func)(call);
// Add a __constructor__ member to the new object, but only for
SWF6 up
// (to be checked). NOTE that we assume the builtin constructors
@@ -2041,10 +2041,11 @@
}
+
void
SWFHandlers::ActionDelete(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+ GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
assert(thread.code[thread.pc] == SWF::ACTION_DELETE); // 0x3A
@@ -2081,6 +2082,7 @@
);
}
+
as_object* obj = (as_object*) object.to_object();
bool ret;
if (obj) {
@@ -2320,7 +2322,7 @@
// Call the array constructor, to create an empty array.
as_value result;
- array_new(fn_call(&result, NULL, &env, 0, env.get_top_index()));
+ result = array_new(fn_call(NULL, &env, 0, env.get_top_index()));
as_object* ao = result.to_object();
assert(ao);
Index: server/vm/action.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/action.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/vm/action.cpp 9 Mar 2007 15:19:26 -0000 1.9
+++ server/vm/action.cpp 19 Mar 2007 17:11:14 -0000 1.10
@@ -226,7 +226,7 @@
// arg2 is at env->bottom(6), etc.
{
as_value val;
- fn_call call(&val, this_ptr, env, nargs, first_arg_bottom_index);
+ fn_call call(this_ptr, env, nargs, first_arg_bottom_index);
try
{
@@ -241,7 +241,7 @@
if ( as_function* as_func = method.to_as_function() )
{
// It's an ActionScript function. Call it.
- (*as_func)(call);
+ val = (*as_func)(call);
}
else
{
@@ -465,10 +465,11 @@
//
-void
+as_value
event_test(const fn_call& /*fn*/)
{
log_msg("FIXME: %s\n", __FUNCTION__);
+ return as_value();
}
Index: server/vm/fn_call.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/fn_call.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/vm/fn_call.h 7 Feb 2007 13:31:26 -0000 1.2
+++ server/vm/fn_call.h 19 Mar 2007 17:11:14 -0000 1.3
@@ -43,17 +43,15 @@
class fn_call
{
public:
- as_value* result;
as_object* this_ptr;
as_environment* env;
- int nargs;
+ unsigned int nargs;
int first_arg_bottom_index;
- fn_call(as_value* res_in, as_object* this_in,
+ fn_call(as_object* this_in,
as_environment* env_in,
int nargs_in, int first_in)
:
- result(res_in),
this_ptr(this_in),
env(env_in),
nargs(nargs_in),
@@ -62,7 +60,7 @@
}
/// Access a particular argument.
- as_value& arg(int n) const
+ as_value& arg(unsigned int n) const
{
assert(n < nargs);
return env->bottom(first_arg_bottom_index - n);
@@ -71,7 +69,7 @@
/// Dump arguments to given output stream
void dump_args(std::ostream& os) const
{
- for (int i=0; i<nargs; ++i)
+ for (unsigned int i=0; i<nargs; ++i)
{
if ( i ) os << ", ";
os << arg(i).to_string();
@@ -81,7 +79,7 @@
};
/// Signature of a builtin function callable from ActionScript
-typedef void (*as_c_function_ptr)(const fn_call& fn);
+typedef as_value (*as_c_function_ptr)(const fn_call& fn);
} // namespace gnash
Index: testsuite/server/GetterSetterTest.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/GetterSetterTest.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- testsuite/server/GetterSetterTest.cpp 15 Mar 2007 22:39:54 -0000
1.7
+++ testsuite/server/GetterSetterTest.cpp 19 Mar 2007 17:11:15 -0000
1.8
@@ -39,16 +39,16 @@
using namespace gnash;
/// return the object's text value
-static void getter(const fn_call& fn)
+static as_value getter(const fn_call& fn)
{
as_object* o = fn.this_ptr;
assert(fn.nargs == 0);
const char* txt = o->get_text_value();
- fn.result->set_string(txt);
+ return as_value(txt);
}
/// set a new member to the object
-static void setter(const fn_call& fn)
+static as_value setter(const fn_call& fn)
{
as_object* o = fn.this_ptr;
assert(fn.nargs == 1);
@@ -93,7 +93,7 @@
GetterSetter getset(*get, *set);
as_value val;
- getset.getValue(&obj, val);
+ val = getset.getValue(&obj);
check_equals(obj.getText(), string("initial text"));
check_equals(val, as_value("initial text"));
@@ -102,14 +102,14 @@
check_equals(obj.getText(), string("second try"));
val.set_string("");
- getset.getValue(&obj, val);
+ val = getset.getValue(&obj);
check_equals(val, as_value("second try"));
// Test copy ctor
GetterSetter getset2(getset);
- getset2.getValue(&obj2, val);
+ val = getset2.getValue(&obj2);
check_equals(obj2.getText(), string("other obj"));
check_equals(val, as_value("other obj"));
@@ -118,19 +118,19 @@
check_equals(obj2.getText(), string("second try for other"));
val.set_string("");
- getset2.getValue(&obj2, val);
+ val = getset2.getValue(&obj2);
check_equals(val, as_value("second try for other"));
- getset2.getValue(&obj, val);
+ val = getset2.getValue(&obj);
check_equals(val, as_value("second try"));
// Test assignment
GetterSetter tmp(getset);
- tmp.getValue(&obj, val);
+ val = tmp.getValue(&obj);
check_equals(val, as_value("second try"));
tmp = getset2;
- tmp.getValue(&obj2, val);
+ val = tmp.getValue(&obj2);
check_equals(val, as_value("second try for other"));
}