gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/asobj/Global.cpp testsui...


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog server/asobj/Global.cpp testsui...
Date: Tue, 29 Apr 2008 10:23:50 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/04/29 10:23:50

Modified files:
        .              : ChangeLog 
        server/asobj   : Global.cpp 
        testsuite/actionscript.all: ASnative.as 

Log message:
                * server/asobj/Global.cpp: tidy up, register ASnative functions,
                  as ASnew (still unimplemented). Log once more often, drop 
                  c_str() usage.
                * testsuite/ASnative.cpp: tests for ASnative(2, 0) (old ASnew).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6440&r2=1.6441
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.120&r2=1.121
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/ASnative.as?cvsroot=gnash&r1=1.7&r2=1.8

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6440
retrieving revision 1.6441
diff -u -b -r1.6440 -r1.6441
--- ChangeLog   29 Apr 2008 09:20:11 -0000      1.6440
+++ ChangeLog   29 Apr 2008 10:23:48 -0000      1.6441
@@ -1,5 +1,12 @@
 2008-04-29 Benjamin Wolsey <address@hidden>
 
+       * server/asobj/Global.cpp: tidy up, register ASnative functions,
+         as ASnew (still unimplemented). Log once more often, drop 
+         c_str() usage.
+       * testsuite/ASnative.cpp: tests for ASnative(2, 0) (old ASnew).
+
+2008-04-29 Benjamin Wolsey <address@hidden>
+
        * testsuite/MovieTester.cpp: function name change.
 
 2008-04-29 Sandro Santilli <address@hidden>

Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -b -r1.120 -r1.121
--- server/asobj/Global.cpp     25 Apr 2008 15:28:53 -0000      1.120
+++ server/asobj/Global.cpp     29 Apr 2008 10:23:49 -0000      1.121
@@ -104,8 +104,8 @@
     //
     // @@ Nothing needs special treatment,
     //    as_value::to_string() will take care of everything
-    const char* arg0 = fn.arg(0).to_string().c_str();
-    log_trace("%s", arg0);
+    log_trace("%s", fn.arg(0).to_string());
+
     return as_value();
 }
 
@@ -123,7 +123,7 @@
 {
     ASSERT_FN_ARGS_IS_1
 
-    return as_value( (bool)isfinite(fn.arg(0).to_number()) );
+    return as_value( static_cast<bool>(isfinite(fn.arg(0).to_number())) );
 }
 
 /// \brief Encode a string to URL-encoded format
@@ -145,7 +145,7 @@
 
     std::string input = fn.arg(0).to_string();
     URL::encode(input);
-    return as_value(input.c_str());
+    return as_value(input);
 }
 
 /// \brief Decode a string from URL-encoded format
@@ -163,7 +163,7 @@
 
     std::string input = fn.arg(0).to_string();
     URL::decode(input);
-    return as_value(input.c_str());
+    return as_value(input);
 }
 
 // parseFloat (string)
@@ -380,7 +380,7 @@
                IF_VERBOSE_ASCODING_ERRORS(
                log_aserror(_("Invalid call to ASSetPropFlags: "
                        "first argument is not an object: %s"),
-                       fn.arg(0).to_debug_string().c_str());
+                       fn.arg(0).to_debug_string());
                );
                return as_value();
     }
@@ -428,7 +428,7 @@
        if (fn.nargs < 2)
        {
                IF_VERBOSE_ASCODING_ERRORS(     
-               log_aserror(_("ASNative(%s): needs at least two arguments"), 
fn.dump_args().c_str());
+               log_aserror(_("ASNative(%s): needs at least two arguments"), 
fn.dump_args());
                )
                return ret;
        }
@@ -439,14 +439,14 @@
        if ( sx < 0 )
        {
                IF_VERBOSE_ASCODING_ERRORS(     
-               log_aserror(_("ASNative(%s): first arg must be >= 0"), 
fn.dump_args().c_str());
+               log_aserror(_("ASNative(%s): first arg must be >= 0"), 
fn.dump_args());
                )
                return ret;
        }
        if ( sy < 0 )
        {
                IF_VERBOSE_ASCODING_ERRORS(     
-               log_aserror(_("ASNative(%s): second arg must be >= 0"), 
fn.dump_args().c_str());
+               log_aserror(_("ASNative(%s): second arg must be >= 0"), 
fn.dump_args());
                )
                return ret;
        }
@@ -465,12 +465,20 @@
                
 }
 
+// Obsolete ASnew function (exists only as ASnative(2, 0))
+static as_value
+as_global_asnew(const fn_call& /*fn*/)
+{
+       LOG_ONCE(log_unimpl("ASNative (2, 0) - old ASnew"));
+       return as_value();
+}
+
 // ASSetNative function
 // TODO: find dox 
 static as_value
 as_global_assetnative(const fn_call& /*fn*/)
 {
-       log_unimpl("ASSetNative");
+       LOG_ONCE(log_unimpl("ASSetNative"));
        return as_value();
 }
 
@@ -479,7 +487,7 @@
 static as_value
 as_global_assetnativeaccessor(const fn_call& /*fn*/)
 {
-       log_unimpl("ASSetNativeAccessor");
+       LOG_ONCE(log_unimpl("ASSetNativeAccessor"));
        return as_value();
 }
 
@@ -488,7 +496,7 @@
 static as_value
 as_global_asconstructor(const fn_call& /*fn*/)
 {
-       log_unimpl("ASconstructor");
+       LOG_ONCE(log_unimpl("ASconstructor"));
        return as_value();
 }
 
@@ -496,12 +504,7 @@
 static as_value
 as_global_updateAfterEvent(const fn_call& /*fn*/)
 {
-       static bool warned=false;
-       if ( ! warned )
-       {
-               log_unimpl("updateAfterEvent()");
-               warned=true;
-       }
+       LOG_ONCE(log_unimpl("updateAfterEvent()"));
        return as_value();
 }
 
@@ -531,28 +534,27 @@
        as_value nullVal; nullVal.set_null();
        init_member("o", nullVal, as_prop_flags::dontEnum);
 
-       // ASSetPropFlags
+       // ASNew was dropped as a builtin function but exists
+       // as ASnative.
        vm.registerNative(as_global_assetpropflags, 1, 0);
-       init_member("ASSetPropFlags", vm.getNative(1, 0));
+       vm.registerNative(as_global_asnew, 2, 0);       
+       vm.registerNative(as_global_assetnative, 4, 0); 
+       vm.registerNative(as_global_assetnativeaccessor, 4, 1);
+       vm.registerNative(as_global_updateAfterEvent, 9, 0);    
+       vm.registerNative(timer_setinterval, 250, 0);
+       vm.registerNative(timer_clearinterval, 250, 1);
 
-       // ASnative
+    // _global functions.              
+       init_member("ASSetPropFlags", vm.getNative(1, 0));
        init_member("ASnative", new builtin_function(as_global_asnative));
-
-       // ASSetNative
-       init_member("ASSetNative", new builtin_function(as_global_assetnative));
-
-       // ASSetNativeAccessor
-       init_member("ASSetNativeAccessor", new 
builtin_function(as_global_assetnativeaccessor));
-
-       // ASconstructor
+       init_member("ASSetNative", vm.getNative(4, 0));
+       init_member("ASSetNativeAccessor", vm.getNative(4, 1));
        init_member("ASconstructor", new 
builtin_function(as_global_asconstructor));
-
-       // updateAfterEvent
-       init_member("updateAfterEvent", new 
builtin_function(as_global_updateAfterEvent));
+       init_member("updateAfterEvent", vm.getNative(9, 0));
 
        // Defined in timers.h
-       init_member("setInterval", new builtin_function(timer_setinterval));
-       init_member("clearInterval", new builtin_function(timer_clearinterval));
+       init_member("setInterval", vm.getNative(250, 0));
+       init_member("clearInterval", vm.getNative(250, 1));
        init_member("setTimeout", new builtin_function(timer_settimeout));
        init_member("clearTimeout", new builtin_function(timer_clearinterval));
 
@@ -612,17 +614,17 @@
        //-----------------------
 
     vm.registerNative(as_global_escape, 100, 0);
-       init_member("escape", vm.getNative(100, 0));
        vm.registerNative(as_global_unescape, 100, 1);
-       init_member("unescape", vm.getNative(100, 1));
     vm.registerNative(as_global_parseint, 100, 2);
-       init_member("parseInt", vm.getNative(100, 2));
     vm.registerNative(as_global_parsefloat, 100, 3);
-       init_member("parseFloat", vm.getNative(100, 3));
-       
        vm.registerNative(as_global_isnan, 200, 18);
-       init_member("isNaN", vm.getNative(200, 18));
        vm.registerNative(as_global_isfinite, 200, 19);
+
+       init_member("escape", vm.getNative(100, 0));
+       init_member("unescape", vm.getNative(100, 1));
+       init_member("parseInt", vm.getNative(100, 2));
+       init_member("parseFloat", vm.getNative(100, 3));
+       init_member("isNaN", vm.getNative(200, 18));
        init_member("isFinite", vm.getNative(200, 19));
 
        // NaN and Infinity should only be in _global since SWF6,

Index: testsuite/actionscript.all/ASnative.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/ASnative.as,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- testsuite/actionscript.all/ASnative.as      29 Apr 2008 08:53:37 -0000      
1.7
+++ testsuite/actionscript.all/ASnative.as      29 Apr 2008 10:23:50 -0000      
1.8
@@ -15,9 +15,25 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-rcsid="$Id: ASnative.as,v 1.7 2008/04/29 08:53:37 bwy Exp $";
+rcsid="$Id: ASnative.as,v 1.8 2008/04/29 10:23:50 bwy Exp $";
 #include "check.as"
 
+/// Global
+
+// Old ASnew
+a = ASnative(2, 0);
+
+var result = "";
+function func() {
+    if (a()) { result = "true"; }
+    else { result =  "false"; }
+};
+
+func();
+check_equals (result, "false");
+discard = new func();
+xcheck_equals (result, "true");
+
 a = ASnative (100, 0); // escape
 check_equals(a(" "), "%20");
 a = ASnative (100, 1); // unescape
@@ -48,7 +64,6 @@
 check_equals(typeof(f.getMilliseconds()), 'undefined');
 check_equals(typeof(f().getMilliseconds()), 'undefined');
 
-
 d = new Date (123456789);
 
 d.a = ASnative(103, 0);
@@ -232,7 +247,7 @@
 xcheck_equals (countVO, 25);
 
 #if OUTPUT_VERSION > 5
-check_totals(74);
+check_totals(76);
 #else
-check_totals(72);
+check_totals(74);
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]