[Swfdec] 5 commits - doc/Makefile.am doc/swfdec-sections.txt libswfdec/Makefile.am libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_initialize.as libswfdec/swfdec_initialize.h libswfdec/swfdec_player_as.c

Benjamin Otte company at kemper.freedesktop.org
Thu Jul 26 13:28:55 PDT 2007


 doc/Makefile.am                |    1 
 doc/swfdec-sections.txt        |    1 
 libswfdec/Makefile.am          |    8 ++
 libswfdec/swfdec_as_object.c   |   58 +++++++++++++++------
 libswfdec/swfdec_as_object.h   |    4 +
 libswfdec/swfdec_initialize.as |    7 ++
 libswfdec/swfdec_initialize.h  |  110 ++++++++++++++++++++---------------------
 libswfdec/swfdec_player_as.c   |   78 ++++++++++++++++++++++++-----
 8 files changed, 182 insertions(+), 85 deletions(-)

New commits:
diff-tree 13033450e2eb8c051d53c6a17a7aa11b88daad9e (from 4b9595646109aa01417c7331d582bcff5e2ca6cf)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Jul 26 21:35:57 2007 +0200

    initialize Stage using ASSetNativeAccessor
    
    This allows using addProperty in Flash 5

diff --git a/libswfdec/swfdec_initialize.as b/libswfdec/swfdec_initialize.as
index c922016..6012fbb 100644
--- a/libswfdec/swfdec_initialize.as
+++ b/libswfdec/swfdec_initialize.as
@@ -17,6 +17,10 @@
  * Boston, MA  02110-1301  USA
  */
 
+/*** GENERAL ***/
+
+ASSetNativeAccessor = ASnative (4, 1);
+
 /*** ASBROADCASTER ***/
 
 function AsBroadcaster () { };
@@ -61,4 +65,5 @@ AsBroadcaster.initialize (Mouse);
 /*** STAGE ***/
 
 Stage = new Object ();
-Stage.addProperty ("scaleMode", ASnative (666, 1), ASnative (666, 2));
+ASSetNativeAccessor (Stage, 666, "scaleMode", 1);
+
diff --git a/libswfdec/swfdec_initialize.h b/libswfdec/swfdec_initialize.h
index 2660c64..c8799fb 100644
--- a/libswfdec/swfdec_initialize.h
+++ b/libswfdec/swfdec_initialize.h
@@ -2,61 +2,61 @@
 
 /* compiled from swfdec_initialize.as */
 const unsigned char swfdec_initialize[] = {
-  0x88, 0xFA, 0x00, 0x19,  0x00, 0x41, 0x73, 0x42,  0x72, 0x6F, 0x61, 0x64,  0x63, 0x61, 0x73, 0x74,
-  0x65, 0x72, 0x00, 0x62,  0x72, 0x6F, 0x61, 0x64,  0x63, 0x61, 0x73, 0x74,  0x4D, 0x65, 0x73, 0x73,
-  0x61, 0x67, 0x65, 0x00,  0x41, 0x53, 0x6E, 0x61,  0x74, 0x69, 0x76, 0x65,  0x00, 0x61, 0x64, 0x64,
-  0x4C, 0x69, 0x73, 0x74,  0x65, 0x6E, 0x65, 0x72,  0x00, 0x74, 0x68, 0x69,  0x73, 0x00, 0x78, 0x00,
-  0x72, 0x65, 0x6D, 0x6F,  0x76, 0x65, 0x4C, 0x69,  0x73, 0x74, 0x65, 0x6E,  0x65, 0x72, 0x00, 0x5F,
-  0x6C, 0x69, 0x73, 0x74,  0x65, 0x6E, 0x65, 0x72,  0x73, 0x00, 0x70, 0x75,  0x73, 0x68, 0x00, 0x6C,
-  0x00, 0x69, 0x00, 0x6C,  0x65, 0x6E, 0x67, 0x74,  0x68, 0x00, 0x73, 0x70,  0x6C, 0x69, 0x63, 0x65,
-  0x00, 0x69, 0x6E, 0x69,  0x74, 0x69, 0x61, 0x6C,  0x69, 0x7A, 0x65, 0x00,  0x6F, 0x00, 0x41, 0x72,
-  0x72, 0x61, 0x79, 0x00,  0x62, 0x72, 0x6F, 0x61,  0x64, 0x63, 0x61, 0x73,  0x74, 0x4D, 0x65, 0x73,
-  0x73, 0x61, 0x67, 0x65,  0x2C, 0x61, 0x64, 0x64,  0x4C, 0x69, 0x73, 0x74,  0x65, 0x6E, 0x65, 0x72,
-  0x2C, 0x72, 0x65, 0x6D,  0x6F, 0x76, 0x65, 0x4C,  0x69, 0x73, 0x74, 0x65,  0x6E, 0x65, 0x72, 0x2C,
-  0x5F, 0x6C, 0x69, 0x73,  0x74, 0x65, 0x6E, 0x65,  0x72, 0x73, 0x00, 0x41,  0x53, 0x53, 0x65, 0x74,
-  0x50, 0x72, 0x6F, 0x70,  0x46, 0x6C, 0x61, 0x67,  0x73, 0x00, 0x4D, 0x6F,  0x75, 0x73, 0x65, 0x00,
-  0x4F, 0x62, 0x6A, 0x65,  0x63, 0x74, 0x00, 0x73,  0x68, 0x6F, 0x77, 0x00,  0x68, 0x69, 0x64, 0x65,
-  0x00, 0x53, 0x74, 0x61,  0x67, 0x65, 0x00, 0x73,  0x63, 0x61, 0x6C, 0x65,  0x4D, 0x6F, 0x64, 0x65,
-  0x00, 0x61, 0x64, 0x64,  0x50, 0x72, 0x6F, 0x70,  0x65, 0x72, 0x74, 0x79,  0x00, 0x9B, 0x12, 0x00,
-  0x41, 0x73, 0x42, 0x72,  0x6F, 0x61, 0x64, 0x63,  0x61, 0x73, 0x74, 0x65,  0x72, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x96, 0x02,  0x00, 0x08, 0x00, 0x1C,  0x96, 0x13, 0x00, 0x08,  0x01, 0x07, 0x0C, 0x00,
-  0x00, 0x00, 0x07, 0x65,  0x00, 0x00, 0x00, 0x07,  0x02, 0x00, 0x00, 0x00,  0x08, 0x02, 0x3D, 0x4F,
-  0x96, 0x02, 0x00, 0x08,  0x00, 0x1C, 0x96, 0x02,  0x00, 0x08, 0x03, 0x9B,  0x07, 0x00, 0x00, 0x01,
-  0x00, 0x78, 0x00, 0x3C,  0x00, 0x96, 0x02, 0x00,  0x08, 0x05, 0x1C, 0x96,  0x07, 0x00, 0x07, 0x01,
-  0x00, 0x00, 0x00, 0x08,  0x04, 0x1C, 0x96, 0x02,  0x00, 0x08, 0x06, 0x52,  0x17, 0x96, 0x02, 0x00,
-  0x08, 0x05, 0x1C, 0x96,  0x07, 0x00, 0x07, 0x01,  0x00, 0x00, 0x00, 0x08,  0x04, 0x1C, 0x96, 0x02,
-  0x00, 0x08, 0x07, 0x4E,  0x96, 0x02, 0x00, 0x08,  0x08, 0x52, 0x17, 0x96,  0x02, 0x00, 0x05, 0x01,
-  0x3E, 0x4F, 0x96, 0x02,  0x00, 0x08, 0x00, 0x1C,  0x96, 0x02, 0x00, 0x08,  0x06, 0x9B, 0x07, 0x00,
-  0x00, 0x01, 0x00, 0x78,  0x00, 0x8F, 0x00, 0x96,  0x04, 0x00, 0x08, 0x09,  0x08, 0x04, 0x1C, 0x96,
-  0x02, 0x00, 0x08, 0x07,  0x4E, 0x3C, 0x96, 0x02,  0x00, 0x08, 0x0A, 0x41,  0x96, 0x07, 0x00, 0x08,
-  0x0A, 0x07, 0x00, 0x00,  0x00, 0x00, 0x3C, 0x99,  0x02, 0x00, 0x09, 0x00,  0x96, 0x02, 0x00, 0x08,
-  0x0A, 0x4C, 0x1C, 0x50,  0x1D, 0x96, 0x02, 0x00,  0x08, 0x0A, 0x1C, 0x96,  0x02, 0x00, 0x08, 0x09,
-  0x1C, 0x96, 0x02, 0x00,  0x08, 0x0B, 0x4E, 0x48,  0x12, 0x9D, 0x02, 0x00,  0x42, 0x00, 0x96, 0x02,
-  0x00, 0x08, 0x09, 0x1C,  0x96, 0x02, 0x00, 0x08,  0x0A, 0x1C, 0x4E, 0x96,  0x02, 0x00, 0x08, 0x05,
+  0x88, 0x02, 0x01, 0x19,  0x00, 0x41, 0x53, 0x53,  0x65, 0x74, 0x4E, 0x61,  0x74, 0x69, 0x76, 0x65,
+  0x41, 0x63, 0x63, 0x65,  0x73, 0x73, 0x6F, 0x72,  0x00, 0x41, 0x53, 0x6E,  0x61, 0x74, 0x69, 0x76,
+  0x65, 0x00, 0x41, 0x73,  0x42, 0x72, 0x6F, 0x61,  0x64, 0x63, 0x61, 0x73,  0x74, 0x65, 0x72, 0x00,
+  0x62, 0x72, 0x6F, 0x61,  0x64, 0x63, 0x61, 0x73,  0x74, 0x4D, 0x65, 0x73,  0x73, 0x61, 0x67, 0x65,
+  0x00, 0x61, 0x64, 0x64,  0x4C, 0x69, 0x73, 0x74,  0x65, 0x6E, 0x65, 0x72,  0x00, 0x74, 0x68, 0x69,
+  0x73, 0x00, 0x78, 0x00,  0x72, 0x65, 0x6D, 0x6F,  0x76, 0x65, 0x4C, 0x69,  0x73, 0x74, 0x65, 0x6E,
+  0x65, 0x72, 0x00, 0x5F,  0x6C, 0x69, 0x73, 0x74,  0x65, 0x6E, 0x65, 0x72,  0x73, 0x00, 0x70, 0x75,
+  0x73, 0x68, 0x00, 0x6C,  0x00, 0x69, 0x00, 0x6C,  0x65, 0x6E, 0x67, 0x74,  0x68, 0x00, 0x73, 0x70,
+  0x6C, 0x69, 0x63, 0x65,  0x00, 0x69, 0x6E, 0x69,  0x74, 0x69, 0x61, 0x6C,  0x69, 0x7A, 0x65, 0x00,
+  0x6F, 0x00, 0x41, 0x72,  0x72, 0x61, 0x79, 0x00,  0x62, 0x72, 0x6F, 0x61,  0x64, 0x63, 0x61, 0x73,
+  0x74, 0x4D, 0x65, 0x73,  0x73, 0x61, 0x67, 0x65,  0x2C, 0x61, 0x64, 0x64,  0x4C, 0x69, 0x73, 0x74,
+  0x65, 0x6E, 0x65, 0x72,  0x2C, 0x72, 0x65, 0x6D,  0x6F, 0x76, 0x65, 0x4C,  0x69, 0x73, 0x74, 0x65,
+  0x6E, 0x65, 0x72, 0x2C,  0x5F, 0x6C, 0x69, 0x73,  0x74, 0x65, 0x6E, 0x65,  0x72, 0x73, 0x00, 0x41,
+  0x53, 0x53, 0x65, 0x74,  0x50, 0x72, 0x6F, 0x70,  0x46, 0x6C, 0x61, 0x67,  0x73, 0x00, 0x4D, 0x6F,
+  0x75, 0x73, 0x65, 0x00,  0x4F, 0x62, 0x6A, 0x65,  0x63, 0x74, 0x00, 0x73,  0x68, 0x6F, 0x77, 0x00,
+  0x68, 0x69, 0x64, 0x65,  0x00, 0x53, 0x74, 0x61,  0x67, 0x65, 0x00, 0x73,  0x63, 0x61, 0x6C, 0x65,
+  0x4D, 0x6F, 0x64, 0x65,  0x00, 0x9B, 0x12, 0x00,  0x41, 0x73, 0x42, 0x72,  0x6F, 0x61, 0x64, 0x63,
+  0x61, 0x73, 0x74, 0x65,  0x72, 0x00, 0x00, 0x00,  0x00, 0x00, 0x96, 0x13,  0x00, 0x08, 0x00, 0x07,
+  0x01, 0x00, 0x00, 0x00,  0x07, 0x04, 0x00, 0x00,  0x00, 0x07, 0x02, 0x00,  0x00, 0x00, 0x08, 0x01,
+  0x3D, 0x1D, 0x96, 0x02,  0x00, 0x08, 0x02, 0x1C,  0x96, 0x13, 0x00, 0x08,  0x03, 0x07, 0x0C, 0x00,
+  0x00, 0x00, 0x07, 0x65,  0x00, 0x00, 0x00, 0x07,  0x02, 0x00, 0x00, 0x00,  0x08, 0x01, 0x3D, 0x4F,
+  0x96, 0x02, 0x00, 0x08,  0x02, 0x1C, 0x96, 0x02,  0x00, 0x08, 0x04, 0x9B,  0x07, 0x00, 0x00, 0x01,
+  0x00, 0x78, 0x00, 0x3C,  0x00, 0x96, 0x02, 0x00,  0x08, 0x06, 0x1C, 0x96,  0x07, 0x00, 0x07, 0x01,
+  0x00, 0x00, 0x00, 0x08,  0x05, 0x1C, 0x96, 0x02,  0x00, 0x08, 0x07, 0x52,  0x17, 0x96, 0x02, 0x00,
+  0x08, 0x06, 0x1C, 0x96,  0x07, 0x00, 0x07, 0x01,  0x00, 0x00, 0x00, 0x08,  0x05, 0x1C, 0x96, 0x02,
+  0x00, 0x08, 0x08, 0x4E,  0x96, 0x02, 0x00, 0x08,  0x09, 0x52, 0x17, 0x96,  0x02, 0x00, 0x05, 0x01,
+  0x3E, 0x4F, 0x96, 0x02,  0x00, 0x08, 0x02, 0x1C,  0x96, 0x02, 0x00, 0x08,  0x07, 0x9B, 0x07, 0x00,
+  0x00, 0x01, 0x00, 0x78,  0x00, 0x8F, 0x00, 0x96,  0x04, 0x00, 0x08, 0x0A,  0x08, 0x05, 0x1C, 0x96,
+  0x02, 0x00, 0x08, 0x08,  0x4E, 0x3C, 0x96, 0x02,  0x00, 0x08, 0x0B, 0x41,  0x96, 0x07, 0x00, 0x08,
+  0x0B, 0x07, 0x00, 0x00,  0x00, 0x00, 0x3C, 0x99,  0x02, 0x00, 0x09, 0x00,  0x96, 0x02, 0x00, 0x08,
+  0x0B, 0x4C, 0x1C, 0x50,  0x1D, 0x96, 0x02, 0x00,  0x08, 0x0B, 0x1C, 0x96,  0x02, 0x00, 0x08, 0x0A,
+  0x1C, 0x96, 0x02, 0x00,  0x08, 0x0C, 0x4E, 0x48,  0x12, 0x9D, 0x02, 0x00,  0x42, 0x00, 0x96, 0x02,
+  0x00, 0x08, 0x0A, 0x1C,  0x96, 0x02, 0x00, 0x08,  0x0B, 0x1C, 0x4E, 0x96,  0x02, 0x00, 0x08, 0x06,
   0x1C, 0x49, 0x12, 0x9D,  0x02, 0x00, 0x23, 0x00,  0x96, 0x07, 0x00, 0x07,  0x01, 0x00, 0x00, 0x00,
-  0x08, 0x0A, 0x1C, 0x96,  0x07, 0x00, 0x07, 0x02,  0x00, 0x00, 0x00, 0x08,  0x09, 0x1C, 0x96, 0x02,
-  0x00, 0x08, 0x0C, 0x52,  0x17, 0x96, 0x02, 0x00,  0x05, 0x01, 0x3E, 0x99,  0x02, 0x00, 0x9C, 0xFF,
-  0x96, 0x02, 0x00, 0x05,  0x00, 0x3E, 0x4F, 0x96,  0x02, 0x00, 0x08, 0x00,  0x1C, 0x96, 0x02, 0x00,
-  0x08, 0x0D, 0x9B, 0x07,  0x00, 0x00, 0x01, 0x00,  0x6F, 0x00, 0x75, 0x00,  0x96, 0x02, 0x00, 0x08,
-  0x0E, 0x1C, 0x96, 0x13,  0x00, 0x08, 0x01, 0x07,  0x0C, 0x00, 0x00, 0x00,  0x07, 0x65, 0x00, 0x00,
-  0x00, 0x07, 0x02, 0x00,  0x00, 0x00, 0x08, 0x02,  0x3D, 0x4F, 0x96, 0x02,  0x00, 0x08, 0x0E, 0x1C,
-  0x96, 0x04, 0x00, 0x08,  0x03, 0x08, 0x00, 0x1C,  0x96, 0x02, 0x00, 0x08,  0x03, 0x4E, 0x4F, 0x96,
-  0x02, 0x00, 0x08, 0x0E,  0x1C, 0x96, 0x04, 0x00,  0x08, 0x06, 0x08, 0x00,  0x1C, 0x96, 0x02, 0x00,
-  0x08, 0x06, 0x4E, 0x4F,  0x96, 0x02, 0x00, 0x08,  0x0E, 0x1C, 0x96, 0x09,  0x00, 0x08, 0x07, 0x07,
-  0x00, 0x00, 0x00, 0x00,  0x08, 0x0F, 0x40, 0x4F,  0x96, 0x09, 0x00, 0x07,  0x83, 0x00, 0x00, 0x00,
-  0x08, 0x10, 0x08, 0x0E,  0x1C, 0x96, 0x07, 0x00,  0x07, 0x03, 0x00, 0x00,  0x00, 0x08, 0x11, 0x3D,
-  0x17, 0x4F, 0x96, 0x08,  0x00, 0x07, 0x83, 0x00,  0x00, 0x00, 0x02, 0x08,  0x00, 0x1C, 0x96, 0x07,
-  0x00, 0x07, 0x03, 0x00,  0x00, 0x00, 0x08, 0x11,  0x3D, 0x17, 0x96, 0x09,  0x00, 0x08, 0x12, 0x07,
-  0x00, 0x00, 0x00, 0x00,  0x08, 0x13, 0x40, 0x1D,  0x96, 0x02, 0x00, 0x08,  0x12, 0x1C, 0x96, 0x13,
-  0x00, 0x08, 0x14, 0x07,  0x00, 0x00, 0x00, 0x00,  0x07, 0x05, 0x00, 0x00,  0x00, 0x07, 0x02, 0x00,
-  0x00, 0x00, 0x08, 0x02,  0x3D, 0x4F, 0x96, 0x02,  0x00, 0x08, 0x12, 0x1C,  0x96, 0x13, 0x00, 0x08,
-  0x15, 0x07, 0x01, 0x00,  0x00, 0x00, 0x07, 0x05,  0x00, 0x00, 0x00, 0x07,  0x02, 0x00, 0x00, 0x00,
-  0x08, 0x02, 0x3D, 0x4F,  0x96, 0x02, 0x00, 0x08,  0x12, 0x1C, 0x96, 0x07,  0x00, 0x07, 0x01, 0x00,
-  0x00, 0x00, 0x08, 0x00,  0x1C, 0x96, 0x02, 0x00,  0x08, 0x0D, 0x52, 0x17,  0x96, 0x09, 0x00, 0x08,
-  0x16, 0x07, 0x00, 0x00,  0x00, 0x00, 0x08, 0x13,  0x40, 0x1D, 0x96, 0x11,  0x00, 0x07, 0x02, 0x00,
-  0x00, 0x00, 0x07, 0x9A,  0x02, 0x00, 0x00, 0x07,  0x02, 0x00, 0x00, 0x00,  0x08, 0x02, 0x3D, 0x96,
-  0x11, 0x00, 0x07, 0x01,  0x00, 0x00, 0x00, 0x07,  0x9A, 0x02, 0x00, 0x00,  0x07, 0x02, 0x00, 0x00,
-  0x00, 0x08, 0x02, 0x3D,  0x96, 0x09, 0x00, 0x08,  0x17, 0x07, 0x03, 0x00,  0x00, 0x00, 0x08, 0x16,
-  0x1C, 0x96, 0x02, 0x00,  0x08, 0x18, 0x52, 0x17,  0x00
+  0x08, 0x0B, 0x1C, 0x96,  0x07, 0x00, 0x07, 0x02,  0x00, 0x00, 0x00, 0x08,  0x0A, 0x1C, 0x96, 0x02,
+  0x00, 0x08, 0x0D, 0x52,  0x17, 0x96, 0x02, 0x00,  0x05, 0x01, 0x3E, 0x99,  0x02, 0x00, 0x9C, 0xFF,
+  0x96, 0x02, 0x00, 0x05,  0x00, 0x3E, 0x4F, 0x96,  0x02, 0x00, 0x08, 0x02,  0x1C, 0x96, 0x02, 0x00,
+  0x08, 0x0E, 0x9B, 0x07,  0x00, 0x00, 0x01, 0x00,  0x6F, 0x00, 0x75, 0x00,  0x96, 0x02, 0x00, 0x08,
+  0x0F, 0x1C, 0x96, 0x13,  0x00, 0x08, 0x03, 0x07,  0x0C, 0x00, 0x00, 0x00,  0x07, 0x65, 0x00, 0x00,
+  0x00, 0x07, 0x02, 0x00,  0x00, 0x00, 0x08, 0x01,  0x3D, 0x4F, 0x96, 0x02,  0x00, 0x08, 0x0F, 0x1C,
+  0x96, 0x04, 0x00, 0x08,  0x04, 0x08, 0x02, 0x1C,  0x96, 0x02, 0x00, 0x08,  0x04, 0x4E, 0x4F, 0x96,
+  0x02, 0x00, 0x08, 0x0F,  0x1C, 0x96, 0x04, 0x00,  0x08, 0x07, 0x08, 0x02,  0x1C, 0x96, 0x02, 0x00,
+  0x08, 0x07, 0x4E, 0x4F,  0x96, 0x02, 0x00, 0x08,  0x0F, 0x1C, 0x96, 0x09,  0x00, 0x08, 0x08, 0x07,
+  0x00, 0x00, 0x00, 0x00,  0x08, 0x10, 0x40, 0x4F,  0x96, 0x09, 0x00, 0x07,  0x83, 0x00, 0x00, 0x00,
+  0x08, 0x11, 0x08, 0x0F,  0x1C, 0x96, 0x07, 0x00,  0x07, 0x03, 0x00, 0x00,  0x00, 0x08, 0x12, 0x3D,
+  0x17, 0x4F, 0x96, 0x08,  0x00, 0x07, 0x83, 0x00,  0x00, 0x00, 0x02, 0x08,  0x02, 0x1C, 0x96, 0x07,
+  0x00, 0x07, 0x03, 0x00,  0x00, 0x00, 0x08, 0x12,  0x3D, 0x17, 0x96, 0x09,  0x00, 0x08, 0x13, 0x07,
+  0x00, 0x00, 0x00, 0x00,  0x08, 0x14, 0x40, 0x1D,  0x96, 0x02, 0x00, 0x08,  0x13, 0x1C, 0x96, 0x13,
+  0x00, 0x08, 0x15, 0x07,  0x00, 0x00, 0x00, 0x00,  0x07, 0x05, 0x00, 0x00,  0x00, 0x07, 0x02, 0x00,
+  0x00, 0x00, 0x08, 0x01,  0x3D, 0x4F, 0x96, 0x02,  0x00, 0x08, 0x13, 0x1C,  0x96, 0x13, 0x00, 0x08,
+  0x16, 0x07, 0x01, 0x00,  0x00, 0x00, 0x07, 0x05,  0x00, 0x00, 0x00, 0x07,  0x02, 0x00, 0x00, 0x00,
+  0x08, 0x01, 0x3D, 0x4F,  0x96, 0x02, 0x00, 0x08,  0x13, 0x1C, 0x96, 0x07,  0x00, 0x07, 0x01, 0x00,
+  0x00, 0x00, 0x08, 0x02,  0x1C, 0x96, 0x02, 0x00,  0x08, 0x0E, 0x52, 0x17,  0x96, 0x09, 0x00, 0x08,
+  0x17, 0x07, 0x00, 0x00,  0x00, 0x00, 0x08, 0x14,  0x40, 0x1D, 0x96, 0x0E,  0x00, 0x07, 0x01, 0x00,
+  0x00, 0x00, 0x08, 0x18,  0x07, 0x9A, 0x02, 0x00,  0x00, 0x08, 0x17, 0x1C,  0x96, 0x07, 0x00, 0x07,
+  0x04, 0x00, 0x00, 0x00,  0x08, 0x00, 0x3D, 0x17,  0x00
 };
 
diff-tree 4b9595646109aa01417c7331d582bcff5e2ca6cf (from a55dc2529b23ba135fad711e623d307829989996)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Jul 26 21:34:32 2007 +0200

    implement ASSetNativeAccessor

diff --git a/libswfdec/swfdec_player_as.c b/libswfdec/swfdec_player_as.c
index 3da2083..f480226 100644
--- a/libswfdec/swfdec_player_as.c
+++ b/libswfdec/swfdec_player_as.c
@@ -21,15 +21,20 @@
 #include "config.h"
 #endif
 
+/* NB: include this first, it redefines SWFDEC_AS_NATIVE */
+#include "swfdec_asnative.h"
+
 #include "swfdec_player_internal.h"
 #include "swfdec_as_function.h"
 #include "swfdec_as_native_function.h"
 #include "swfdec_as_object.h"
 #include "swfdec_as_strings.h"
-#include "swfdec_asnative.h"
 #include "swfdec_debug.h"
 #include "swfdec_internal.h"
 #include "swfdec_interval.h"
+/* FIXME: to avoid duplicate definitions */
+#undef SWFDEC_AS_NATIVE
+#define SWFDEC_AS_NATIVE(x, y, func)
 
 /*** INTERVALS ***/
 
@@ -90,29 +95,80 @@ swfdec_player_clearInterval (SwfdecAsCon
   swfdec_interval_remove (player, id);
 }
 
+/*** VARIOUS ***/
+
+static SwfdecAsFunction *
+swfdec_get_asnative (SwfdecAsContext *cx, guint x, guint y)
+{
+  guint i;
+
+  for (i = 0; native_funcs[i].func != NULL; i++) {
+    if (native_funcs[i].x == x && native_funcs[i].y == y) {
+      return swfdec_as_native_function_new (cx, native_funcs[i].name,
+	  native_funcs[i].func, 0);
+    }
+  }
+  return NULL;
+}
+
 static void
 swfdec_player_ASnative (SwfdecAsContext *cx, SwfdecAsObject *obj,
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval)
 {
-  guint i, x, y;
+  SwfdecAsFunction *func;
+  guint x, y;
 
   x = swfdec_as_value_to_integer (cx, &argv[0]);
   y = swfdec_as_value_to_integer (cx, &argv[1]);
 
-  for (i = 0; native_funcs[i].func != NULL; i++) {
-    if (native_funcs[i].x == x && native_funcs[i].y == y) {
-      SwfdecAsFunction *func = swfdec_as_native_function_new (cx, native_funcs[i].name,
-	  native_funcs[i].func, 0);
-      if (func)
-	SWFDEC_AS_VALUE_SET_OBJECT (rval, SWFDEC_AS_OBJECT (func));
+  func = swfdec_get_asnative (cx, x, y);
+  if (func) {
+    SWFDEC_AS_VALUE_SET_OBJECT (rval, SWFDEC_AS_OBJECT (func));
+  } else {
+    SWFDEC_FIXME ("ASnative for %u %u missing", x, y);
+  }
+}
+
+SWFDEC_AS_NATIVE (4, 1, ASSetNativeAccessor)
+void
+ASSetNativeAccessor (SwfdecAsContext *cx, SwfdecAsObject *object,
+    guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval)
+{
+  SwfdecAsFunction *get, *set;
+  SwfdecAsObject *target;
+  const char *s;
+  char **names;
+  guint i, x, y;
+
+  if (argc < 3)
+    return;
+
+  target = swfdec_as_value_to_object (cx, &argv[0]);
+  x = swfdec_as_value_to_integer (cx, &argv[1]);
+  s = swfdec_as_value_to_string (cx, &argv[2]);
+  if (argc > 3)
+    y = swfdec_as_value_to_integer (cx, &argv[3]);
+  else
+    y = 0;
+  names = g_strsplit (s, ",", -1);
+  for (i = 0; names[i]; i++) {
+    s = names[i];
+    if (s[0] >= '0' && s[0] <= '9') {
+      SWFDEC_FIXME ("implement the weird numbers");
+      s++;
+    }
+    get = swfdec_get_asnative (cx, x, y++);
+    set = swfdec_get_asnative (cx, x, y++);
+    if (get == NULL) {
+      SWFDEC_ERROR ("no getter for %s", s);
       return;
     }
+    swfdec_as_object_add_variable (target, swfdec_as_context_get_string (cx, s),
+	get, set);
   }
-  SWFDEC_FIXME ("ASnative for %u %u missing", x, y);
+  g_free (names);
 }
 
-/*** VARIOUS ***/
-
 static void
 swfdec_player_object_registerClass (SwfdecAsContext *cx, SwfdecAsObject *object,
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval)
diff-tree a55dc2529b23ba135fad711e623d307829989996 (from 79a46534730bb6e1d19ce2ba5f54a43acdb8a303)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Jul 26 21:34:01 2007 +0200

    update docs

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 494217a..c5766a9 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -68,6 +68,7 @@ IGNORE_HFILES= \
 	swfdec_as_strings.h \
 	swfdec_as_super.h \
 	swfdec_as_with.h \
+	swfdec_asnative.h \
 	swfdec_audio_internal.h \
 	swfdec_audio_event.h \
 	swfdec_audio_flv.h \
diff --git a/doc/swfdec-sections.txt b/doc/swfdec-sections.txt
index 9c9eb75..3048a95 100644
--- a/doc/swfdec-sections.txt
+++ b/doc/swfdec-sections.txt
@@ -266,6 +266,7 @@ SwfdecAsVariableFlag
 swfdec_as_object_get_variable
 swfdec_as_object_get_variable_and_flags
 swfdec_as_object_set_variable
+swfdec_as_object_add_variable
 swfdec_as_object_set_variable_flags
 swfdec_as_object_unset_variable_flags
 swfdec_as_object_delete_variable
diff-tree 79a46534730bb6e1d19ce2ba5f54a43acdb8a303 (from 272b75f217c4ed1ff99d597007caea376790857b)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Jul 26 21:32:38 2007 +0200

    add swfdec_as_object_add_variable()

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 6c4e199..ec00ec2 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -176,6 +176,12 @@ swfdec_as_object_do_get (SwfdecAsObject 
   return TRUE;
 }
 
+static gboolean
+swfdec_as_variable_name_is_valid (const char *name)
+{
+  return name != SWFDEC_AS_STR_EMPTY;
+}
+
 static SwfdecAsVariable *
 swfdec_as_object_lookup_variable (SwfdecAsObject *object, const char *variable)
 {
@@ -185,18 +191,14 @@ swfdec_as_object_lookup_variable (Swfdec
   if (var == NULL) {
     if (!swfdec_as_context_use_mem (object->context, sizeof (SwfdecAsVariable)))
       return NULL;
+    if (!swfdec_as_variable_name_is_valid (variable))
+      return NULL;
     var = g_slice_new0 (SwfdecAsVariable);
     g_hash_table_insert (object->properties, (gpointer) variable, var);
   }
   return var;
 }
 
-static gboolean
-swfdec_as_variable_name_is_valid (const char *name)
-{
-  return name != SWFDEC_AS_STR_EMPTY;
-}
-
 static void
 swfdec_as_object_do_set (SwfdecAsObject *object, const char *variable, 
     const SwfdecAsValue *val)
@@ -934,6 +936,39 @@ swfdec_as_object_set_constructor (Swfdec
   swfdec_as_object_set_variable (object, scripted ? SWFDEC_AS_STR_constructor : SWFDEC_AS_STR___constructor__, &val);
 }
 
+/**
+ * swfdec_as_object_add_variable:
+ * @object: a #SwfdecAsObject
+ * @variable: name of the variable
+ * @get: getter function to call when reading the variable
+ * @set: setter function to call when writing the variable or %NULL if read-only
+ *
+ * Adds a variable to @object in the same way as the Actionscript code 
+ * "object.addProperty()" would do. Accessing the variable will from now on be
+ * handled by calling the @get or @set functions. A previous value of the 
+ * variable or a previous call to this function will be overwritten.
+ **/
+void
+swfdec_as_object_add_variable (SwfdecAsObject *object, const char *variable, 
+    SwfdecAsFunction *get, SwfdecAsFunction *set)
+{
+  SwfdecAsVariable *var;
+
+  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (variable != NULL);
+  g_return_if_fail (SWFDEC_IS_AS_FUNCTION (get));
+  g_return_if_fail (set == NULL || SWFDEC_IS_AS_FUNCTION (set));
+
+  var = swfdec_as_object_lookup_variable (object, variable);
+  if (var == NULL)
+    return;
+  var->get = get;
+  var->set = set;
+  var->flags = SWFDEC_AS_VARIABLE_PERMANENT;
+  if (set == NULL)
+    var->flags |= SWFDEC_AS_VARIABLE_READONLY;
+}
+
 /*** AS CODE ***/
 
 static void
@@ -941,7 +976,6 @@ swfdec_as_object_addProperty (SwfdecAsCo
     guint argc, SwfdecAsValue *argv, SwfdecAsValue *retval)
 {
   SwfdecAsFunction *get, *set;
-  SwfdecAsVariable *var;
   const char *name;
 
   SWFDEC_AS_VALUE_SET_BOOLEAN (retval, FALSE);
@@ -961,15 +995,7 @@ swfdec_as_object_addProperty (SwfdecAsCo
     return;
   }
 
-  var = swfdec_as_object_lookup_variable (object, name);
-  if (var == NULL)
-    return;
-  var->get = get;
-  var->set = set;
-  var->flags = SWFDEC_AS_VARIABLE_PERMANENT;
-  if (set == NULL)
-    var->flags |= SWFDEC_AS_VARIABLE_READONLY;
-
+  swfdec_as_object_add_variable (object, name, get, set);
   SWFDEC_AS_VALUE_SET_BOOLEAN (retval, TRUE);
 }
 
diff --git a/libswfdec/swfdec_as_object.h b/libswfdec/swfdec_as_object.h
index bb2efeb..04deb10 100644
--- a/libswfdec/swfdec_as_object.h
+++ b/libswfdec/swfdec_as_object.h
@@ -113,6 +113,10 @@ void		swfdec_as_object_add		(SwfdecAsObj
 void		swfdec_as_object_set_variable	(SwfdecAsObject *	object,
 						 const char *		variable,
 						 const SwfdecAsValue *	value);
+void		swfdec_as_object_add_variable	(SwfdecAsObject *	object,
+						 const char *		variable, 
+						 SwfdecAsFunction *	get,
+						 SwfdecAsFunction *	set);
 #define swfdec_as_object_get_variable(object, variable, value) \
   swfdec_as_object_get_variable_and_flags (object, variable, value, NULL, NULL)
 gboolean	swfdec_as_object_get_variable_and_flags
diff-tree 272b75f217c4ed1ff99d597007caea376790857b (from e9a1e2cf91496460342ffc67cdf965ad1bf73044)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Jul 26 21:24:00 2007 +0200

    make swfdec_asnative.h work on its own
    
    so the autogeneration code needed to be changed

diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am
index ed5330e..ae81146 100644
--- a/libswfdec/Makefile.am
+++ b/libswfdec/Makefile.am
@@ -226,14 +226,18 @@ CLEANFILES = \
 	$(BUILT_SOURCES)
 
 swfdec_asnative.h: $(libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES)
-	(echo "#include \"swfdec_player.h\"" \
+	(echo "#include \"swfdec_as_types.h\"" \
+	  && echo "#define SWFDEC_AS_NATIVE(x, y, func) void func (SwfdecAsContext *cx, \\" \
+	  && echo "    SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret);" \
 	  && grep -he "^SWFDEC_AS_NATIVE" $(libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES) \
 	  && echo "#undef SWFDEC_AS_NATIVE" \
 	  && echo "#define SWFDEC_AS_NATIVE(x,y,func) { x, y, func, G_STRINGIFY (func) }," \
 	  && echo "static const struct { guint x, y; SwfdecAsNative func; const char *name; } native_funcs[] = {" \
 	  && grep -he "^SWFDEC_AS_NATIVE" $(libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES) \
 	  && echo "  { 0, 0, NULL }" \
-	  && echo "};") >> xgen-san \
+	  && echo "};" \
+	  && echo "#undef SWFDEC_AS_NATIVE" \
+	 ) >> xgen-san \
 	&& (cmp -s xgen-san swfdec_asnative.h || cp xgen-san swfdec_asnative.h) \
 	&& rm -f xgen-san
 


More information about the Swfdec mailing list