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 server/...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/Global.cpp server/...
Date: Mon, 23 Oct 2006 07:41:52 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/10/23 07:41:51

Modified files:
        .              : ChangeLog 
        server/asobj   : Global.cpp Makefile.am 
Added files:
        server/asobj   : Number.cpp Number.h 

Log message:
        new Number ActionScript class (to be finished)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1350&r2=1.1351
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Makefile.am?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Number.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Number.h?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1350
retrieving revision 1.1351
diff -u -b -r1.1350 -r1.1351
--- ChangeLog   22 Oct 2006 22:53:27 -0000      1.1350
+++ ChangeLog   23 Oct 2006 07:41:51 -0000      1.1351
@@ -1,3 +1,8 @@
+2006-10-22 Sandro Santilli <address@hidden>
+
+       * server/asobj/: Global.cpp, Makefile.am, Number.cpp, Number.h:
+       new Number ActionScript class (to be finished)
+
 2006-10-22 Bastiaan Jacques <address@hidden>
 
        * libbase/log.h: size_t cannot be long long, so don't check for it.

Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/asobj/Global.cpp     11 Oct 2006 14:03:42 -0000      1.13
+++ server/asobj/Global.cpp     23 Oct 2006 07:41:51 -0000      1.14
@@ -18,7 +18,7 @@
 
 // Implementation of the Global ActionScript Object
 
-/* $Id: Global.cpp,v 1.13 2006/10/11 14:03:42 strk Exp $ */
+/* $Id: Global.cpp,v 1.14 2006/10/23 07:41:51 strk Exp $ */
 
 #include "as_object.h"
 #include "array.h"
@@ -36,6 +36,7 @@
 #include "LoadVars.h"
 #include "LocalConnection.h"
 #include "Microphone.h"
+#include "Number.h"
 #include "GMath.h"
 #include "Mouse.h"
 #include "MovieClipLoader.h"
@@ -470,6 +471,7 @@
        // isFinite
        set_member("isFinite", as_global_isfinite);
 
+       number_class_init(*this); 
        string_class_init(*this); 
        array_class_init(*this);
        function_init(this);

Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/asobj/Makefile.am    15 Oct 2006 09:11:20 -0000      1.10
+++ server/asobj/Makefile.am    23 Oct 2006 07:41:51 -0000      1.11
@@ -36,7 +36,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.10 2006/10/15 09:11:20 nihilus Exp $
+# $Id: Makefile.am,v 1.11 2006/10/23 07:41:51 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -85,6 +85,7 @@
         MovieClipLoader.cpp\
        NetConnection.cpp\
        NetStream.cpp   \
+       Number.cpp      \
        Selection.cpp   \
        SharedObject.cpp\
        ASSound.cpp     \
@@ -114,6 +115,7 @@
        MovieClipLoader.h \
        NetConnection.h \
        NetStream.h     \
+       Number.h        \
        Selection.h     \
        SharedObject.h  \
        Stage.h         \

Index: server/asobj/Number.cpp
===================================================================
RCS file: server/asobj/Number.cpp
diff -N server/asobj/Number.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/asobj/Number.cpp     23 Oct 2006 07:41:51 -0000      1.1
@@ -0,0 +1,143 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+// 
+//
+//
+
+/* $Id: Number.cpp,v 1.1 2006/10/23 07:41:51 strk Exp $ */
+
+// Implementation of ActionScript Number class.
+
+#include "tu_config.h"
+#include "Number.h"
+#include "smart_ptr.h"
+#include "fn_call.h"
+#include "as_object.h" // for inheritance
+#include "builtin_function.h" // need builtin_function
+
+#include <sstream>
+
+namespace gnash {
+
+// Forward declarations
+//static void number_to_string(const fn_call& fn);
+
+static void
+attachNumberInterface(as_object& o)
+{
+       // FIXME: add Number interface here:
+       // Number.MAX_VALUE
+       // Number.MIN_VALUE
+       // Number.NaN
+       // Number.NEGATIVE_INFINITY
+       // Number.POSITIVE_INFINITY
+       // Number.toString()
+       // Number.valueOf()
+}
+
+static as_object*
+getNumberInterface()
+{
+       static as_object* o=NULL;
+       if ( o == NULL )
+       {
+               o = new as_object();
+               attachNumberInterface(*o);
+       }
+       return o;
+}
+
+// FIXME: add some useful methods :)
+class number_as_object : public as_object
+{
+       // the number value
+       double _val;
+
+       // string representation of the above number
+       mutable char _str[256];
+
+public:
+
+       number_as_object(double val=0.0)
+               :
+               as_object(getNumberInterface()),
+               _val(val)
+       {
+               sprintf(_str, "%g", _val);
+       }
+
+       const char* get_text_value() const
+       {
+               return _str;
+       }
+
+};
+
+
+static void
+number_ctor(const fn_call& fn)
+{
+       double val = 0;
+       if (fn.nargs > 0)
+       {
+               val = fn.arg(0).to_number();
+       }
+
+       number_as_object* obj = new number_as_object(val);
+       
+       fn.result->set_as_object(obj);
+}
+
+// extern (used by Global.cpp)
+void number_class_init(as_object& global)
+{
+       // This is going to be the global Number "class"/"function"
+       static builtin_function* cl=NULL;
+
+       if ( cl == NULL )
+       {
+               cl=new builtin_function(&number_ctor, getNumberInterface());
+               // replicate all interface to class, to be able to access
+               // all methods as static functions
+               attachNumberInterface(*cl);
+                    
+       }
+
+       // Register _global.Number
+       global.set_member("Number", cl);
+
+}
+  
+} // namespace gnash

Index: server/asobj/Number.h
===================================================================
RCS file: server/asobj/Number.h
diff -N server/asobj/Number.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/asobj/Number.h       23 Oct 2006 07:41:51 -0000      1.1
@@ -0,0 +1,53 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Linking Gnash statically or dynamically with other modules is making a
+// combined work based on Gnash. Thus, the terms and conditions of the GNU
+// General Public License cover the whole combination.
+//
+// As a special exception, the copyright holders of Gnash give you
+// permission to combine Gnash with free software programs or libraries
+// that are released under the GNU LGPL and with code included in any
+// release of Talkback distributed by the Mozilla Foundation. You may
+// copy and distribute such a system following the terms of the GNU GPL
+// for all but the LGPL-covered parts and Talkback, and following the
+// LGPL for the LGPL-covered parts.
+//
+// Note that people who make modified versions of Gnash are not obligated
+// to grant this special exception for their modified versions; it is their
+// choice whether to do so. The GNU General Public License gives permission
+// to release a modified version without this exception; this exception
+// also makes it possible to release a modified version which carries
+// forward this exception.
+// 
+//
+//
+
+// Implementation for ActionScript Number object.
+
+#ifndef GNASH_NUMBER_H
+#define GNASH_NUMBER_H
+
+namespace gnash {
+
+class as_object;
+
+/// Initialize the global Number class
+void number_class_init(as_object& global);
+
+}
+
+#endif // GNASH_NUMBER_H




reply via email to

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