gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/ASna...


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog testsuite/actionscript.all/ASna...
Date: Sun, 20 Apr 2008 17:53:58 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/04/20 17:53:58

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

Log message:
                * server/asobj/Date.{h,cpp}: make date_as_object into Date 
class,
                  remove direct access to value member. Drop remaining casts; 
use
                  to_int() instead.
                * testsuite/actionscript.all/ASnative.as: more tests for 
ASnative
                  date function. All full AS classes with ASnative 
'constructors'
                  need some redoing (Date, for instance).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6334&r2=1.6335
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/ASnative.as?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Date.cpp?cvsroot=gnash&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Date.h?cvsroot=gnash&r1=1.13&r2=1.14

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6334
retrieving revision 1.6335
diff -u -b -r1.6334 -r1.6335
--- ChangeLog   19 Apr 2008 22:45:51 -0000      1.6334
+++ ChangeLog   20 Apr 2008 17:53:57 -0000      1.6335
@@ -1,3 +1,12 @@
+2008-04-20 Benjamin Wolsey <address@hidden>
+
+       * server/asobj/Date.{h,cpp}: make date_as_object into Date class,
+         remove direct access to value member. Drop remaining casts; use
+         to_int() instead.
+       * testsuite/actionscript.all/ASnative.as: more tests for ASnative
+         date function. All full AS classes with ASnative 'constructors'
+         need some redoing (Date, for instance).       
+
 2008-04-19 Sandro Santilli <address@hidden>
 
        * server/edit_text_character.cpp (textfield_setTextFormat): use

Index: testsuite/actionscript.all/ASnative.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/ASnative.as,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- testsuite/actionscript.all/ASnative.as      16 Apr 2008 11:16:34 -0000      
1.5
+++ testsuite/actionscript.all/ASnative.as      20 Apr 2008 17:53:58 -0000      
1.6
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-rcsid="$Id: ASnative.as,v 1.5 2008/04/16 11:16:34 bwy Exp $";
+rcsid="$Id: ASnative.as,v 1.6 2008/04/20 17:53:58 bwy Exp $";
 #include "check.as"
 
 a = ASnative (100, 0); // escape
@@ -35,10 +35,19 @@
 
 e = ASnative(103, 256); // _global.Date
 xcheck_equals(e().valueOf(), Date().valueOf());
+g = e;
+xcheck_equals(typeOf(g().valueOf()), 'string');
+
+xcheck_equals(e(100000).valueOf(), Date().valueOf());
+
+g = e();
+check_equals(typeOf(g.getMilliseconds), 'undefined');
 
 f = new e(100000000); // not instantiatable
 xcheck_equals(typeof(f), 'object');
 check_equals(typeof(f.getMilliseconds()), 'undefined');
+check_equals(typeof(f().getMilliseconds()), 'undefined');
+
 
 d = new Date (123456789);
 
@@ -195,7 +204,7 @@
 xcheck_equals (countVO, 25);
 
 #if OUTPUT_VERSION > 5
-check_totals(66);
+check_totals(70);
 #else
-check_totals(64);
+check_totals(68);
 #endif

Index: server/asobj/Date.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Date.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- server/asobj/Date.cpp       16 Apr 2008 11:16:35 -0000      1.66
+++ server/asobj/Date.cpp       20 Apr 2008 17:53:58 -0000      1.67
@@ -235,6 +235,7 @@
     // as there should be no difference:
     vm.registerNative(date_getseconds, 103, 135);
     vm.registerNative(date_getmilliseconds, 103, 136);
+
     vm.registerNative(date_setutcfullyear, 103, 137);
     vm.registerNative(date_setutcmonth, 103, 138);
     vm.registerNative(date_setutcdate, 103, 139);
@@ -243,6 +244,8 @@
     vm.registerNative(date_setutcseconds, 103, 142);
     vm.registerNative(date_setutcmilliseconds, 103, 143);
 
+    //vm.registerNative(date_new, 103, 256);
+
     vm.registerNative(date_utc, 103, 257);
 
 }
@@ -316,31 +319,27 @@
     return o.get();
 }
 
-class date_as_object : public as_object
-{
-public:
-    // value is the master field and the Date's value, and holds the
-    // date as the number of milliseconds since midnight 1 Jan 1970.
-    // All other "fields" are calculated from this.
-    double value;   // milliseconds UTC since the epoch
 
-    date_as_object()
+Date::Date()
             :
-        as_object(getDateInterface())
-    {
-    }
+    as_object(getDateInterface()),
+    _value(clocktime::getTicks())
+{
 
-    as_value toString();
+}
 
-    bool isDateObject() { return true; }
 
-private:
+Date::Date(double value)
+    :
+    as_object(getDateInterface()),
+    _value(value)
+{
 
-};
+}
 
 
 as_value
-date_as_object::toString()
+Date::toString() const
 {
     const char* monthname[12] = { "Jan", "Feb", "Mar",
                                   "Apr", "May", "Jun",
@@ -351,7 +350,7 @@
                                    "Thu", "Fri", "Sat" };
   
     /// NAN and infinities all print as "Invalid Date"
-    if (isnan(value) || isinf(value)) {
+    if (isnan(_value) || isinf(_value)) {
         return as_value("Invalid Date");
     }
   
@@ -359,7 +358,7 @@
     GnashTime gt;
     // Time zone offset (including DST) as hours and minutes east of GMT
 
-    getLocalTime(value, gt);
+    getLocalTime(_value, gt);
 
     int offsetHours = gt.timeZoneOffset / 60;
     int offsetMinutes = gt.timeZoneOffset % 60;    
@@ -396,11 +395,8 @@
 as_value
 date_new(const fn_call& fn)
 {
-    // TODO: just make date_as_object constructor
-    //       register the exported interface, don't
-    //       replicate all functions !!
 
-    date_as_object *date = new date_as_object;
+       boost::intrusive_ptr<Date> date;
 
     // Reject all date specifications containing Infinities and NaNs.
     // The commercial player does different things according to which
@@ -408,18 +404,17 @@
     // for now, we just use rogue_date_args' algorithm
     double foo;
     if ((foo = rogue_date_args(fn, 7)) != 0.0) {
-        date->value = foo;
-        return as_value(date);
+        date = new Date(foo);
+        return as_value(date.get());
     }
 
-    // TODO: move this to date_as_object constructor
     if (fn.nargs < 1 || fn.arg(0).is_undefined() || !(fn.isInstantiation()) ) {
-        // Set from system clock
-        date->value = clocktime::getTicks();
+        // Time now
+        date = new Date;
     }
     else if (fn.nargs == 1) {
         // Set the value in milliseconds since 1970 UTC
-        date->value = fn.arg(0).to_number();
+        date = new Date(fn.arg(0).to_number());
     }
     else {
         // Create a time from the supplied (at least 2) arguments.
@@ -430,9 +425,9 @@
         gt.minute = 0;
         gt.hour = 0;
         gt.monthday = 1;
-        gt.month = static_cast<int>(fn.arg(1).to_number());
+        gt.month = fn.arg(1).to_int();
     
-        int year = static_cast<int>(fn.arg(0).to_number());
+        int year = fn.arg(0).to_int();
         
         // GnashTime.year is the value since 1900 (like struct tm)
         // negative value is a year before 1900. A year between 0
@@ -450,15 +445,15 @@
                 )
             case 7:
                 // fractions of milliseconds are ignored
-                gt.millisecond = (int)fn.arg(6).to_number();
+                gt.millisecond = fn.arg(6).to_int();
             case 6:
-                gt.second = (int)fn.arg(5).to_number();
+                gt.second = fn.arg(5).to_int();
             case 5:
-                gt.minute = (int)fn.arg(4).to_number();
+                gt.minute = fn.arg(4).to_int();
             case 4:
-                gt.hour = (int)fn.arg(3).to_number();
+                gt.hour = fn.arg(3).to_int();
             case 3:
-                gt.monthday = (int)fn.arg(2).to_number();
+                gt.monthday = fn.arg(2).to_int();
             case 2:
                 break;
                 // Done already
@@ -469,10 +464,10 @@
         // due to shortcomings in the timezoneoffset calculation, but should
         // be internally consistent.
         double localTime = makeTimeValue(gt);
-        date->value = localTime - clocktime::getTimeZoneOffset(localTime) * 
60000;
+        date = new Date(localTime - clocktime::getTimeZoneOffset(localTime) * 
60000);
     }
     
-    return as_value(date);
+    return as_value(date.get());
 }
 
 //
@@ -491,10 +486,10 @@
 
 #define date_get_proto(function, timefn, element) \
   static as_value function(const fn_call& fn) { \
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr); \
-    if (isnan(date->value) || isinf(date->value)) { as_value rv; rv.set_nan(); 
return rv; } \
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr); \
+    if (isnan(date->getTimeValue()) || isinf(date->getTimeValue())) { as_value 
rv; rv.set_nan(); return rv; } \
     GnashTime gt; \
-    timefn(date->value, gt); \
+    timefn(date->getTimeValue(), gt); \
     return as_value(gt.element); \
   }
 
@@ -579,8 +574,8 @@
 static as_value
 date_gettimezoneoffset(const fn_call& fn)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
-    return as_value( -getLocalTimeZoneOffset(date->value) );
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
+    return as_value( -getLocalTimeZoneOffset(date->getTimeValue()) );
 }
 
 
@@ -594,7 +589,7 @@
 static as_value
 date_settime(const fn_call& fn)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
 
     if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -603,7 +598,7 @@
     }
     else {
         // returns a double
-        date->value = fn.arg(0).to_number();
+        date->setTimeValue(fn.arg(0).to_number());
     }
 
     if (fn.nargs > 1) {
@@ -612,7 +607,7 @@
         )
     }
 
-    return as_value(date->value);
+    return as_value(date->getTimeValue());
 }
 
 //
@@ -633,23 +628,23 @@
 // instead. Apart from the bottom-level conversions they are identical.
 
 static void
-gnashTimeToDate(GnashTime& gt, date_as_object& date, bool utc)
+gnashTimeToDate(GnashTime& gt, Date& date, bool utc)
 {
     // Needs timezone.
-    if (utc) date.value = makeTimeValue(gt);
+    if (utc) date.setTimeValue(makeTimeValue(gt));
 
     else {
         double localTime = makeTimeValue(gt);
-        date.value = localTime - clocktime::getTimeZoneOffset(localTime) * 
60000;
+        date.setTimeValue(localTime - clocktime::getTimeZoneOffset(localTime) 
* 60000);
     }
 }
 
 static void
-dateToGnashTime(date_as_object& date, GnashTime& gt, bool utc)
+dateToGnashTime(Date& date, GnashTime& gt, bool utc)
 {
     // Needs timezone.
-    if (utc) getUniversalTime(date.value, gt);
-    else getLocalTime(date.value, gt);
+    if (utc) getUniversalTime(date.getTimeValue(), gt);
+    else getLocalTime(date.getTimeValue(), gt);
 }
 
 //
@@ -691,24 +686,24 @@
 // to the day the clocks go forward.
 
 static as_value _date_setfullyear(const fn_call& fn, bool utc) {
-  boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
+  boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
 
   if (fn.nargs < 1) {
       IF_VERBOSE_ASCODING_ERRORS(
     log_aserror(_("Date.setFullYear needs one argument"));
       )
-      date->value = NAN;
+      date->setTimeValue(NAN);
   } else if (rogue_date_args(fn, 3) != 0.0) {
-      date->value = NAN;
+      date->setTimeValue(NAN);
   } else {
       GnashTime gt;
 
       dateToGnashTime(*date, gt, utc);
-      gt.year = (int) fn.arg(0).to_number() - 1900;
+      gt.year = fn.arg(0).to_int() - 1900;
       if (fn.nargs >= 2)
-        gt.month = (int) fn.arg(1).to_number();
+        gt.month = fn.arg(1).to_int();
       if (fn.nargs >= 3)
-        gt.monthday = (int) fn.arg(2).to_number();
+        gt.monthday = fn.arg(2).to_int();
       if (fn.nargs > 3) {
     IF_VERBOSE_ASCODING_ERRORS(
         log_aserror(_("Date.setFullYear was called with more than three 
arguments"));
@@ -716,7 +711,7 @@
       }
       gnashTimeToDate(gt, *date, utc);
   }
-  return as_value(date->value);
+  return as_value(date->getTimeValue());
 }
 
 /// \brief Date.setYear(year[,month[,day]])
@@ -736,17 +731,17 @@
 static as_value
 date_setyear(const fn_call& fn)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
 
     // assert(fn.nargs == 1);
     if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("Date.setYear needs one argument"));
         )
-        date->value = NAN;
+        date->setTimeValue(NAN);
     }
     else if (rogue_date_args(fn, 3) != 0.0) {
-        date->value = NAN;
+        date->setTimeValue(NAN);
     }
     else {
         GnashTime gt;
@@ -763,7 +758,7 @@
         }
         gnashTimeToDate(gt, *date, false); // utc=false: use localtime
     }
-    return as_value(date->value);
+    return as_value(date->getTimeValue());
 }
 
 /// \brief Date.setMonth(month[,day])
@@ -782,17 +777,17 @@
 static as_value
 _date_setmonth(const fn_call& fn, bool utc)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
 
     // assert(fn.nargs >= 1 && fn.nargs <= 2);
     if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("Date.setMonth needs one argument"));
         )
-        date->value = NAN;
+        date->setTimeValue(NAN);
     }
     else if (rogue_date_args(fn, 2) != 0.0) {
-        date->value = NAN;
+        date->setTimeValue(NAN);
     }
     else {
 
@@ -804,17 +799,17 @@
         // January
         double monthvalue =  fn.arg(0).to_number();
         if (isnan(monthvalue) || isinf(monthvalue)) monthvalue = 0.0;
-        gt.month = (int) monthvalue;
+        gt.month = static_cast<int>(monthvalue);
 
         // If the day-of-month value is invalid instead, the result is NAN.
         if (fn.nargs >= 2) {
             double mdayvalue = fn.arg(1).to_number();
             if (isnan(mdayvalue) || isinf(mdayvalue)) {
-                date->value = NAN;
-                return as_value(date->value);
+                date->setTimeValue(NAN);
+                return as_value(date->getTimeValue());
             }
             else {
-                gt.monthday = (int) mdayvalue;
+                gt.monthday = static_cast<int>(mdayvalue);
             }
         }
         if (fn.nargs > 2) {
@@ -824,7 +819,7 @@
         }
         gnashTimeToDate(gt, *date, utc);
     }
-    return as_value(date->value);
+    return as_value(date->getTimeValue());
 }
 
 /// \brief Date.setDate(day)
@@ -834,15 +829,15 @@
 /// day > 31. Example: setting the 35th in January results in Feb 4th.
 static as_value
 _date_setdate(const fn_call& fn, bool utc) {
-  boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
+  boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
 
   if (fn.nargs < 1) {
       IF_VERBOSE_ASCODING_ERRORS(
     log_aserror(_("Date.setDate needs one argument"));
       )
-      date->value = NAN;  // Is what FlashPlayer sets
+      date->setTimeValue(NAN);  // Is what FlashPlayer sets
   } else if (rogue_date_args(fn, 1) != 0.0) {
-      date->value = NAN;
+      date->setTimeValue(NAN);
   } else {
     GnashTime gt;
 
@@ -855,7 +850,7 @@
     log_aserror(_("Date.setDate was called with more than one argument"));
       )
   }
-  return as_value(date->value);
+  return as_value(date->getTimeValue());
 }
 
 /// \brief Date.setHours(hour[,min[,sec[,millisec]]])
@@ -872,17 +867,17 @@
 static as_value
 _date_sethours(const fn_call& fn, bool utc)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
 
     // assert(fn.nargs >= 1 && fn.nargs <= 4);
     if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("Date.setHours needs one argument"));
         )
-        date->value = NAN;  // Is what FlashPlayer sets
+        date->setTimeValue(NAN);  // Is what FlashPlayer sets
     }
     else if (rogue_date_args(fn, 4) != 0.0) {
-        date->value = NAN;
+        date->setTimeValue(NAN);
     }
     else {
       
@@ -901,7 +896,7 @@
         
         gnashTimeToDate(gt, *date, utc);
     }
-    return as_value(date->value);
+    return as_value(date->getTimeValue());
 }
 
 /// \brief Date.setMinutes(minutes[,secs[,millisecs]])
@@ -915,26 +910,26 @@
 static as_value
 _date_setminutes(const fn_call& fn, bool utc)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
 
     //assert(fn.nargs >= 1 && fn.nargs <= 3);
     if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("Date.setMinutes needs one argument"));
         )
-        date->value = NAN;  // FlashPlayer instead leaves the date set to
+        date->setTimeValue(NAN);  // FlashPlayer instead leaves the date set to
         // a random value such as 9th December 2077 BC
     }
     else if (rogue_date_args(fn, 3) != 0.0) {
-        date->value = NAN;
+        date->setTimeValue(NAN);
     }
     else {
         GnashTime gt;
 
         dateToGnashTime(*date, gt, utc);
-        gt.minute = (int) fn.arg(0).to_number();
-        if (fn.nargs >= 2) gt.second = (int) fn.arg(1).to_number();
-        if (fn.nargs >= 3) gt.millisecond = (int) fn.arg(2).to_number();
+        gt.minute = fn.arg(0).to_int();
+        if (fn.nargs >= 2) gt.second = fn.arg(1).to_int();
+        if (fn.nargs >= 3) gt.millisecond = fn.arg(2).to_int();
         if (fn.nargs > 3) {
             IF_VERBOSE_ASCODING_ERRORS(
                 log_aserror(_("Date.setMinutes was called with more than three 
arguments"));
@@ -942,7 +937,7 @@
         }
         gnashTimeToDate(gt, *date, utc);
     }
-    return as_value(date->value);
+    return as_value(date->getTimeValue());
 }
 
 /// \brief Date.setSeconds(secs[,millisecs])
@@ -953,17 +948,17 @@
 static as_value
 _date_setseconds(const fn_call& fn, bool utc)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
 
     // assert(fn.nargs >= 1 && fn.nargs <= 2);
     if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("Date.setSeconds needs one argument"));
         )
-        date->value = NAN;  // Same as commercial player
+        date->setTimeValue(NAN);  // Same as commercial player
     }
     else if (rogue_date_args(fn, 2) != 0.0) {
-        date->value = NAN;
+        date->setTimeValue(NAN);
     }
     else {
         // We *could* set seconds [and milliseconds] without breaking the
@@ -985,23 +980,23 @@
         // Use utc to avoid needless worrying about timezones.
         gnashTimeToDate(gt, *date, utc);
     }
-    return as_value(date->value);
+    return as_value(date->getTimeValue());
 }
 
 static as_value
 _date_setmilliseconds(const fn_call& fn, bool utc)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
 
     // assert(fn.nargs == 1);
     if (fn.nargs < 1) {
         IF_VERBOSE_ASCODING_ERRORS(
             log_aserror(_("Date.setMilliseconds needs one argument"));
         )
-        date->value = NAN;
+        date->setTimeValue(NAN);
     }
     else if (rogue_date_args(fn, 1) != 0.0) {
-        date->value = NAN;
+        date->setTimeValue(NAN);
     }
     else {
     
@@ -1021,7 +1016,7 @@
         gnashTimeToDate(gt, *date, utc);
 
     }
-    return as_value(date->value);
+    return as_value(date->getTimeValue());
 }
 
 // Bindings for localtime versions
@@ -1062,8 +1057,7 @@
 static as_value
 date_tostring(const fn_call& fn)
 {
-    boost::intrusive_ptr<date_as_object> date = 
-                    ensureType<date_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
     return date->toString();
 }
 
@@ -1208,15 +1202,15 @@
 static as_value
 date_valueof(const fn_call& fn)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
-    return as_value(date->value);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
+    return as_value(date->getTimeValue());
 }
 
 
 static as_value date_gettime(const fn_call& fn)
 {
-    boost::intrusive_ptr<date_as_object> date = 
ensureType<date_as_object>(fn.this_ptr);
-    return as_value(date->value);
+    boost::intrusive_ptr<Date> date = ensureType<Date>(fn.this_ptr);
+    return as_value(date->getTimeValue());
 }
 
 // extern (used by Global.cpp)
@@ -1226,9 +1220,9 @@
     static boost::intrusive_ptr<builtin_function> cl;
 
     if ( cl == NULL ) {
-        cl=new builtin_function(&date_new, getDateInterface());
-        // replicate all interface to class, to be able to access
-        // all methods as static functions
+        cl = new builtin_function(&date_new, getDateInterface());
+        
+        // replicate static interface to class (Date.UTC)
         attachDateStaticInterface(*cl);
     }
 

Index: server/asobj/Date.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Date.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/asobj/Date.h 16 Apr 2008 11:16:35 -0000      1.13
+++ server/asobj/Date.h 20 Apr 2008 17:53:58 -0000      1.14
@@ -23,7 +23,25 @@
 
 namespace gnash {
 
+class Date : public as_object
+{
+public:
+    void setTimeValue(const double& value) { _value = value; }
+    double getTimeValue() const { return _value; }
+
+    Date();
+    Date(double value);
+    
+    as_value toString() const;
+    
+    bool isDateObject() { return true; }
+    
+private:
+    double _value;
+};
+
 void registerDateNative(as_object& global);
+
 void date_class_init(as_object& global);
 
 } // end of gnash namespace




reply via email to

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