[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/doc/C/refmanual new_as_class.xml as_value...
From: |
Rob Savoye |
Subject: |
[Gnash-commit] gnash/doc/C/refmanual new_as_class.xml as_value... |
Date: |
Sat, 01 Mar 2008 17:25:15 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Rob Savoye <rsavoye> 08/03/01 17:25:15
Modified files:
doc/C/refmanual: new_as_class.xml as_value.xml
Log message:
* doc/C/refmanual/new_as_class.xml: changes to a chapter. Merge
main.xml into body. Include as_value.xml from here.
* doc/C/refmanual/as_value.xml: Make a sect1 for new_as_class.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/doc/C/refmanual/new_as_class.xml?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/doc/C/refmanual/as_value.xml?cvsroot=gnash&r1=1.1&r2=1.2
Patches:
Index: new_as_class.xml
===================================================================
RCS file: /sources/gnash/gnash/doc/C/refmanual/new_as_class.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- new_as_class.xml 1 Mar 2008 15:15:30 -0000 1.1
+++ new_as_class.xml 1 Mar 2008 17:25:15 -0000 1.2
@@ -1,7 +1,15 @@
- <sect1 id="newclass">
+<chapter id="newclass">
<title>Adding New ActionScript Class</title>
<para>
+ In this document, the term 'ActionScript class' refers to the
+ C++ class which is instantiated by Gnash when some ActionScript
+ code instantiates a corresponding class. The C++ class
+ stores instance data and implements the methods which are
+ called on the object in the ActionScript code.
+ </para>
+
+ <para>
Adding a new ActionScript class is relatively simple, but the
process is complicated by the fact that the interface has evolved
over time and the current code base represents several different
@@ -17,7 +25,7 @@
for instance <emphasis>Boolean.cpp</emphasis> for the Boolean class.
</para>
- <sect2 id="prototype">
+ <sect1 id="prototype">
<title>Prototype</title>
<para>
@@ -34,8 +42,7 @@
following example demonstrates how methods can be attached:
<programlisting>
static void
- attachBooleanInterface(as_object& o)
- {
+ attachBooleanInterface(as_object& o) {
o.init_member("toString", new
builtin_function(boolean_tostring));
o.init_member("valueOf", new
builtin_function(boolean_valueof));
}
@@ -61,31 +68,36 @@
}
</programlisting>
</para>
- </sect2>
+ </sect1>
- <sect2 id="declaration">
+ <sect1 id="declaration">
<title>Declaration</title>
<para>
A new class should derive from <emphasis>as_object</emphasis>,
which is the base class of every ActionScript object in Gnash.
</para>
- </sect2>
+ </sect1>
- <sect2 id="instantiation">
+ <sect1 id="instantiation">
<title>Instantiation</title>
<para>
- The class should contain an init method.
+ When a new object is needed, instance data is added to
+ the methods and properties inherited from the prototype.
</para>
<para>
The init method should be called in the constructor in
<emphasis>Global.cpp</emphasis>, where all other ActionScript
- classes are similarly referenced.
+ classes are similarly referenced. This method constructs a
+ prototype, which is implemented as an
+ <emphasis>as_object</emphasis>. In addition, the method
+ registers the constructor to be used for future object creation,
+ and attaches methods and properties to the prototype.
</para>
- </sect2>
+ </sect1>
- <sect2 id="methods">
+ <sect1 id="methods">
<title>Methods</title>
<para>
@@ -147,9 +159,9 @@
stack.
</para>
</sect3>
- </sect2>
+ </sect1>
- <sect2 id="properties">
+ <sect1 id="properties">
<title>Dynamic Properties</title>
<para>
This section describes accessors to dynamic properties.
@@ -170,14 +182,11 @@
<link linkend="return">result pointer</link>. For instance:
<programlisting>
void
- MyClass::myProperty_getset(const fn_call& fn)
- {
-
+ MyClass::myProperty_getset(const fn_call& fn) {
boost::intrusive_ptr<MyClass> ptr =
ensureType<MyClass>(fn.this_ptr);
// setter
- if ( fn.nargs > 0 )
- {
+ if ( fn.nargs > 0 ) {
bool h = fn.arg(0).to_bool();
ptr->MyMethod(h);
return;
@@ -200,5 +209,9 @@
o.init_property("myProperty", *gettersetter, *gettersetter);
</programlisting>
</para>
- </sect2>
</sect1>
+
+ &asvalue;
+
+</chapter>
+
Index: as_value.xml
===================================================================
RCS file: /sources/gnash/gnash/doc/C/refmanual/as_value.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- as_value.xml 1 Mar 2008 15:15:29 -0000 1.1
+++ as_value.xml 1 Mar 2008 17:25:15 -0000 1.2
@@ -1,4 +1,4 @@
- <sect1 id="as_value">
+<sect1 id="as_value">
<title>The <emphasis>as_value</emphasis> Object Type</title>
<para>
The <emphasis>as_value</emphasis> class is used throughout
@@ -72,4 +72,4 @@
</para>
</sect2>
- </sect1>
+</sect1>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash/doc/C/refmanual new_as_class.xml as_value...,
Rob Savoye <=