gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11259: Fix compiler warnings.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11259: Fix compiler warnings.
Date: Wed, 15 Jul 2009 12:09:37 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11259
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2009-07-15 12:09:37 +0200
message:
  Fix compiler warnings.
  
  Always pass as Global_as to to_object(). Drop more direct use of
  builtin_function.
modified:
  extensions/gtk2/gtkext.cpp
  extensions/mysql/mysql_db.cpp
  libcore/ClassHierarchy.cpp
  libcore/MovieClip.cpp
  libcore/TextField.cpp
  libcore/Video.cpp
  libcore/asClass.cpp
  libcore/asMethod.cpp
  libcore/as_environment.cpp
  libcore/as_environment.h
  libcore/as_function.cpp
  libcore/as_object.cpp
  libcore/as_value.cpp
  libcore/as_value.h
  libcore/asobj/Array_as.cpp
  libcore/asobj/AsBroadcaster.cpp
  libcore/asobj/Boolean_as.cpp
  libcore/asobj/Boolean_as.h
  libcore/asobj/Color_as.cpp
  libcore/asobj/Global_as.h
  libcore/asobj/Globals.cpp
  libcore/asobj/Globals.h
  libcore/asobj/LoadableObject.cpp
  libcore/asobj/MovieClipLoader.cpp
  libcore/asobj/NetConnection_as.cpp
  libcore/asobj/NetStream_as.cpp
  libcore/asobj/Number_as.cpp
  libcore/asobj/Number_as.h
  libcore/asobj/Object.cpp
  libcore/asobj/Selection_as.cpp
  libcore/asobj/String_as.cpp
  libcore/asobj/String_as.h
  libcore/asobj/flash/accessibility/AccessibilityProperties_as.cpp
  libcore/asobj/flash/accessibility/Accessibility_as.cpp
  libcore/asobj/flash/desktop/ClipboardTransferMode_as.cpp
  libcore/asobj/flash/desktop/Clipboard_as.cpp
  libcore/asobj/flash/display/AVM1Movie_as.cpp
  libcore/asobj/flash/display/BitmapData_as.cpp
  libcore/asobj/flash/display/Bitmap_as.cpp
  libcore/asobj/flash/display/BlendMode_as.cpp
  libcore/asobj/flash/display/DisplayObjectContainer_as.cpp
  libcore/asobj/flash/display/DisplayObject_as.cpp
  libcore/asobj/flash/display/FrameLabel_as.cpp
  libcore/asobj/flash/display/Graphics_as.cpp
  libcore/asobj/flash/display/IBitmapDrawable_as.cpp
  libcore/asobj/flash/display/InteractiveObject_as.cpp
  libcore/asobj/flash/display/LoaderInfo_as.cpp
  libcore/asobj/flash/display/Loader_as.cpp
  libcore/asobj/flash/display/MorphShape_as.cpp
  libcore/asobj/flash/display/MovieClip_as.cpp
  libcore/asobj/flash/display/Scene_as.cpp
  libcore/asobj/flash/display/Shape_as.cpp
  libcore/asobj/flash/display/SimpleButton_as.cpp
  libcore/asobj/flash/display/Sprite_as.cpp
  libcore/asobj/flash/errors/EOFError_as.cpp
  libcore/asobj/flash/errors/IOError_as.cpp
  libcore/asobj/flash/errors/IllegalOperationError_as.cpp
  libcore/asobj/flash/errors/InvalidSWFError_as.cpp
  libcore/asobj/flash/errors/MemoryError_as.cpp
  libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp
  libcore/asobj/flash/errors/StackOverflowError_as.cpp
  libcore/asobj/flash/events/ActivityEvent_as.cpp
  libcore/asobj/flash/events/AsyncErrorEvent_as.cpp
  libcore/asobj/flash/events/ContextMenuEvent_as.cpp
  libcore/asobj/flash/events/DataEvent_as.cpp
  libcore/asobj/flash/events/ErrorEvent_as.cpp
  libcore/asobj/flash/events/EventDispatcher_as.cpp
  libcore/asobj/flash/events/EventPhase_as.cpp
  libcore/asobj/flash/events/Event_as.cpp
  libcore/asobj/flash/events/FocusEvent_as.cpp
  libcore/asobj/flash/events/FullScreenEvent_as.cpp
  libcore/asobj/flash/events/HTTPStatusEvent_as.cpp
  libcore/asobj/flash/events/IEventDispatcher_as.cpp
  libcore/asobj/flash/events/IMEEvent_as.cpp
  libcore/asobj/flash/events/IOErrorEvent_as.cpp
  libcore/asobj/flash/events/KeyboardEvent_as.cpp
  libcore/asobj/flash/events/MouseEvent_as.cpp
  libcore/asobj/flash/events/NetStatusEvent_as.cpp
  libcore/asobj/flash/events/ProgressEvent_as.cpp
  libcore/asobj/flash/events/SecurityErrorEvent_as.cpp
  libcore/asobj/flash/events/StatusEvent_as.cpp
  libcore/asobj/flash/events/SyncEvent_as.cpp
  libcore/asobj/flash/events/TextEvent_as.cpp
  libcore/asobj/flash/events/TimerEvent_as.cpp
  libcore/asobj/flash/filters/BitmapFilter_as.cpp
  libcore/asobj/flash/filters/ConvolutionFilter_as.cpp
  libcore/asobj/flash/filters/DisplacementMapFilterMode_as.cpp
  libcore/asobj/flash/flash_pkg.cpp
  libcore/asobj/flash/geom/ColorTransform_as.cpp
  libcore/asobj/flash/geom/ColorTransform_as.h
  libcore/asobj/flash/geom/Matrix_as.cpp
  libcore/asobj/flash/geom/Matrix_as.h
  libcore/asobj/flash/geom/Point_as.cpp
  libcore/asobj/flash/geom/Point_as.h
  libcore/asobj/flash/geom/Rectangle_as.cpp
  libcore/asobj/flash/geom/Transform_as.cpp
  libcore/asobj/flash/geom/Transform_as.h
  libcore/asobj/flash/media/ID3Info_as.cpp
  libcore/asobj/flash/media/SoundChannel_as.cpp
  libcore/asobj/flash/media/SoundLoaderContext_as.cpp
  libcore/asobj/flash/media/SoundMixer_as.cpp
  libcore/asobj/flash/media/SoundTransform_as.cpp
  libcore/asobj/flash/media/Sound_as.cpp
  libcore/asobj/flash/media/Video_as.cpp
  libcore/asobj/flash/media/media_as.cpp
  libcore/asobj/flash/net/FileFilter_as.cpp
  libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp
  libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp
  libcore/asobj/flash/net/NetConnection_as.cpp
  libcore/asobj/flash/net/NetStream_as.cpp
  libcore/asobj/flash/net/ObjectEncoding_as.cpp
  libcore/asobj/flash/net/Responder_as.cpp
  libcore/asobj/flash/net/SharedObject_as.cpp
  libcore/asobj/flash/net/Socket_as.cpp
  libcore/asobj/flash/net/URLLoader_as.cpp
  libcore/asobj/flash/net/URLRequestHeader_as.cpp
  libcore/asobj/flash/net/URLRequestMethod_as.cpp
  libcore/asobj/flash/net/URLRequest_as.cpp
  libcore/asobj/flash/net/URLStream_as.cpp
  libcore/asobj/flash/net/URLVariables_as.cpp
  libcore/asobj/flash/net/XMLSocket_as.cpp
  libcore/asobj/flash/printing/PrintJobOptions_as.cpp
  libcore/asobj/flash/printing/PrintJob_as.cpp
  libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp
  libcore/asobj/flash/sampler/NewObjectSample_as.cpp
  libcore/asobj/flash/sampler/Sample_as.cpp
  libcore/asobj/flash/sampler/StackFrame_as.cpp
  libcore/asobj/flash/system/ApplicationDomain_as.cpp
  libcore/asobj/flash/system/Capabilities_as.cpp
  libcore/asobj/flash/system/IMEConversionMode_as.cpp
  libcore/asobj/flash/system/IME_as.cpp
  libcore/asobj/flash/system/LoaderContext_as.cpp
  libcore/asobj/flash/system/SecurityDomain_as.cpp
  libcore/asobj/flash/system/SecurityPanel_as.cpp
  libcore/asobj/flash/system/Security_as.cpp
  libcore/asobj/flash/text/AntiAliasType_as.cpp
  libcore/asobj/flash/text/CSMSettings_as.cpp
  libcore/asobj/flash/text/FontStyle_as.cpp
  libcore/asobj/flash/text/FontType_as.cpp
  libcore/asobj/flash/text/Font_as.cpp
  libcore/asobj/flash/text/StaticText_as.cpp
  libcore/asobj/flash/text/StyleSheet_as.cpp
  libcore/asobj/flash/text/TextField_as.cpp
  libcore/asobj/flash/text/TextFormat_as.cpp
  libcore/asobj/flash/text/TextLineMetrics_as.cpp
  libcore/asobj/flash/text/text_pkg.cpp
  libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp
  libcore/asobj/flash/ui/ContextMenu_as.cpp
  libcore/asobj/flash/ui/KeyLocation_as.cpp
  libcore/asobj/flash/ui/Mouse_as.cpp
  libcore/asobj/flash/utils/ByteArray_as.cpp
  libcore/asobj/flash/utils/Dictionary_as.cpp
  libcore/asobj/flash/utils/Endian_as.cpp
  libcore/asobj/flash/utils/IDataInput_as.cpp
  libcore/asobj/flash/utils/IDataOutput_as.cpp
  libcore/asobj/flash/utils/IExternalizable_as.cpp
  libcore/asobj/flash/utils/Proxy_as.cpp
  libcore/asobj/flash/utils/Timer_as.cpp
  libcore/asobj/flash/xml/XMLDocument_as.cpp
  libcore/asobj/flash/xml/XMLNode_as.cpp
  libcore/debugger.cpp
  libcore/movie_root.cpp
  libcore/swf_function.cpp
  libcore/swf_function.h
  libcore/vm/ASHandlers.cpp
  libcore/vm/Machine.cpp
  libcore/vm/Machine.h
  libcore/vm/fn_call.h
  testsuite/libcore.all/AsValueTest.cpp
    ------------------------------------------------------------
    revno: 11248.1.37
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-07-14 17:33:46 +0200
    message:
      Pass an object to most to_object() calls.
    modified:
      libcore/ClassHierarchy.cpp
      libcore/MovieClip.cpp
      libcore/TextField.cpp
      libcore/Video.cpp
      libcore/asClass.cpp
      libcore/asMethod.cpp
      libcore/as_environment.cpp
      libcore/as_environment.h
      libcore/as_function.cpp
      libcore/as_object.cpp
      libcore/as_value.cpp
      libcore/as_value.h
      libcore/asobj/Array_as.cpp
      libcore/asobj/AsBroadcaster.cpp
      libcore/asobj/Boolean_as.cpp
      libcore/asobj/Boolean_as.h
      libcore/asobj/Color_as.cpp
      libcore/asobj/Global_as.h
      libcore/asobj/Globals.cpp
      libcore/asobj/Globals.h
      libcore/asobj/LoadableObject.cpp
      libcore/asobj/MovieClipLoader.cpp
      libcore/asobj/NetConnection_as.cpp
      libcore/asobj/NetStream_as.cpp
      libcore/asobj/Number_as.cpp
      libcore/asobj/Number_as.h
      libcore/asobj/Object.cpp
      libcore/asobj/Selection_as.cpp
      libcore/asobj/String_as.cpp
      libcore/asobj/String_as.h
      libcore/asobj/flash/display/BitmapData_as.cpp
      libcore/asobj/flash/display/DisplayObjectContainer_as.cpp
      libcore/asobj/flash/display/MovieClip_as.cpp
      libcore/movie_root.cpp
      libcore/vm/ASHandlers.cpp
      libcore/vm/Machine.cpp
      libcore/vm/Machine.h
      libcore/vm/fn_call.h
    ------------------------------------------------------------
    revno: 11248.1.38
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-07-14 17:39:12 +0200
    message:
      Pass object to all to_object() calls.
    modified:
      libcore/asobj/flash/geom/Matrix_as.cpp
      libcore/asobj/flash/geom/Point_as.cpp
      libcore/asobj/flash/geom/Transform_as.cpp
      libcore/asobj/flash/media/Sound_as.cpp
      libcore/asobj/flash/net/SharedObject_as.cpp
      libcore/asobj/flash/ui/ContextMenu_as.cpp
      libcore/asobj/flash/ui/Mouse_as.cpp
      libcore/asobj/flash/xml/XMLDocument_as.cpp
      libcore/asobj/flash/xml/XMLNode_as.cpp
      libcore/debugger.cpp
    ------------------------------------------------------------
    revno: 11248.1.39
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-07-14 17:40:58 +0200
    message:
      Update extensions.
    modified:
      extensions/gtk2/gtkext.cpp
      extensions/mysql/mysql_db.cpp
    ------------------------------------------------------------
    revno: 11248.1.40
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-07-14 18:14:04 +0200
    message:
      Fix testsuite.
    modified:
      testsuite/libcore.all/AsValueTest.cpp
    ------------------------------------------------------------
    revno: 11248.1.41
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-07-14 18:15:13 +0200
    message:
      Really fix testsuite.
    modified:
      testsuite/libcore.all/AsValueTest.cpp
    ------------------------------------------------------------
    revno: 11248.1.42
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Tue 2009-07-14 18:15:25 +0200
    message:
      Deal with string natives properly. Don't include things unnecessarily in
      Global_as.h. Initialize string class without statics.
    modified:
      libcore/asobj/Boolean_as.cpp
      libcore/asobj/Boolean_as.h
      libcore/asobj/Global_as.h
      libcore/asobj/Globals.cpp
      libcore/asobj/Number_as.cpp
      libcore/asobj/Number_as.h
      libcore/asobj/String_as.cpp
      libcore/asobj/String_as.h
    ------------------------------------------------------------
    revno: 11248.1.43
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 08:49:54 +0200
    message:
      Don't expose AS constructors outside the class. This was designed to mimic
      AS behaviour without C++ types by returning the original constructor, but
      in fact ActionScript is even less fussy and looks them up by name, even
      if they have changed.
    modified:
      libcore/asobj/flash/geom/Matrix_as.h
    ------------------------------------------------------------
    revno: 11248.1.44
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 08:52:58 +0200
    message:
      Drop other stuff from headers.
    modified:
      libcore/asobj/flash/geom/ColorTransform_as.h
      libcore/asobj/flash/geom/Transform_as.h
    ------------------------------------------------------------
    revno: 11248.1.45
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 09:08:26 +0200
    message:
      Look up Point class in environment.
    modified:
      libcore/asobj/flash/geom/Rectangle_as.cpp
    ------------------------------------------------------------
    revno: 11248.1.46
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 09:10:27 +0200
    message:
      Clean up Transform_as, drop duplicated (and unused) class creation.
    modified:
      libcore/asobj/flash/geom/Rectangle_as.cpp
      libcore/asobj/flash/geom/Transform_as.cpp
    ------------------------------------------------------------
    revno: 11248.1.47
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 09:37:56 +0200
    message:
      Neither action_buffer nor as_environment are optional for swf_function, 
despite
      what the documentation says. Change the docs, clean up, and make them
      into references.
    modified:
      libcore/swf_function.cpp
      libcore/swf_function.h
      libcore/vm/ASHandlers.cpp
    ------------------------------------------------------------
    revno: 11248.1.48
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 09:53:57 +0200
    message:
      Use Global_as for builtin_function.
    modified:
      libcore/asobj/Boolean_as.cpp
    ------------------------------------------------------------
    revno: 11248.1.49
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 09:54:33 +0200
    message:
      Use Global_as for builtin_function.
    modified:
      libcore/asobj/Number_as.cpp
    ------------------------------------------------------------
    revno: 11248.1.50
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 09:54:55 +0200
    message:
      Don't initialize constructor in ClassHierarchy for extensions either.
    modified:
      libcore/ClassHierarchy.cpp
    ------------------------------------------------------------
    revno: 11248.1.51
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 09:57:08 +0200
    message:
      Drop more direct use of builtin_function.
    modified:
      libcore/asobj/flash/geom/ColorTransform_as.cpp
      libcore/asobj/flash/geom/Matrix_as.cpp
      libcore/asobj/flash/geom/Point_as.cpp
      libcore/asobj/flash/geom/Rectangle_as.cpp
      libcore/asobj/flash/geom/Transform_as.cpp
    ------------------------------------------------------------
    revno: 11248.1.52
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 10:22:32 +0200
    message:
      Allow use of instanceOf(0) without crashing. It is surely a legitimate
      call in AS, and saves having to check every time.
    modified:
      libcore/as_object.cpp
    ------------------------------------------------------------
    revno: 11248.1.53
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 10:23:37 +0200
    message:
      Remove almost the last direct uses of builtin_function.
    modified:
      libcore/asobj/flash/display/MovieClip_as.cpp
      libcore/asobj/flash/filters/BitmapFilter_as.cpp
      libcore/asobj/flash/filters/ConvolutionFilter_as.cpp
      libcore/asobj/flash/geom/Matrix_as.cpp
      libcore/asobj/flash/geom/Point_as.cpp
      libcore/asobj/flash/geom/Point_as.h
      libcore/asobj/flash/net/XMLSocket_as.cpp
    ------------------------------------------------------------
    revno: 11248.1.54
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 11:09:52 +0200
    message:
      Fix signed / unsigned warning.
    modified:
      libcore/movie_root.cpp
    ------------------------------------------------------------
    revno: 11248.1.55
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 11:10:56 +0200
    message:
      Take a Global_as in to_object() to start with.
    modified:
      libcore/ClassHierarchy.cpp
      libcore/MovieClip.cpp
      libcore/asClass.cpp
      libcore/asMethod.cpp
      libcore/as_object.cpp
      libcore/as_value.cpp
      libcore/as_value.h
      libcore/asobj/Array_as.cpp
      libcore/asobj/LoadableObject.cpp
    ------------------------------------------------------------
    revno: 11248.1.56
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 11:21:26 +0200
    message:
      Fix all the unused parameter warnings for as_object& o.
    modified:
      libcore/asobj/flash/accessibility/AccessibilityProperties_as.cpp
      libcore/asobj/flash/desktop/Clipboard_as.cpp
      libcore/asobj/flash/display/AVM1Movie_as.cpp
      libcore/asobj/flash/display/Bitmap_as.cpp
      libcore/asobj/flash/display/BlendMode_as.cpp
      libcore/asobj/flash/display/DisplayObject_as.cpp
      libcore/asobj/flash/display/FrameLabel_as.cpp
      libcore/asobj/flash/display/IBitmapDrawable_as.cpp
      libcore/asobj/flash/display/InteractiveObject_as.cpp
      libcore/asobj/flash/display/LoaderInfo_as.cpp
      libcore/asobj/flash/display/MorphShape_as.cpp
      libcore/asobj/flash/display/Scene_as.cpp
      libcore/asobj/flash/display/Shape_as.cpp
      libcore/asobj/flash/display/SimpleButton_as.cpp
      libcore/asobj/flash/errors/EOFError_as.cpp
      libcore/asobj/flash/errors/IOError_as.cpp
      libcore/asobj/flash/errors/IllegalOperationError_as.cpp
      libcore/asobj/flash/errors/InvalidSWFError_as.cpp
      libcore/asobj/flash/errors/MemoryError_as.cpp
      libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp
      libcore/asobj/flash/errors/StackOverflowError_as.cpp
      libcore/asobj/flash/events/AsyncErrorEvent_as.cpp
      libcore/asobj/flash/events/EventPhase_as.cpp
      libcore/asobj/flash/events/IEventDispatcher_as.cpp
      libcore/asobj/flash/events/KeyboardEvent_as.cpp
      libcore/asobj/flash/events/MouseEvent_as.cpp
      libcore/asobj/flash/events/NetStatusEvent_as.cpp
      libcore/asobj/flash/events/SecurityErrorEvent_as.cpp
      libcore/asobj/flash/events/StatusEvent_as.cpp
      libcore/asobj/flash/events/SyncEvent_as.cpp
      libcore/asobj/flash/events/TimerEvent_as.cpp
      libcore/asobj/flash/media/ID3Info_as.cpp
      libcore/asobj/flash/media/SoundLoaderContext_as.cpp
      libcore/asobj/flash/media/SoundMixer_as.cpp
      libcore/asobj/flash/media/SoundTransform_as.cpp
      libcore/asobj/flash/media/media_as.cpp
      libcore/asobj/flash/net/FileFilter_as.cpp
      libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp
      libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp
      libcore/asobj/flash/net/NetConnection_as.cpp
      libcore/asobj/flash/net/ObjectEncoding_as.cpp
      libcore/asobj/flash/net/Responder_as.cpp
      libcore/asobj/flash/net/Socket_as.cpp
      libcore/asobj/flash/net/URLRequestHeader_as.cpp
      libcore/asobj/flash/net/URLRequest_as.cpp
      libcore/asobj/flash/printing/PrintJobOptions_as.cpp
      libcore/asobj/flash/printing/PrintJob_as.cpp
      libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp
      libcore/asobj/flash/sampler/NewObjectSample_as.cpp
      libcore/asobj/flash/sampler/Sample_as.cpp
      libcore/asobj/flash/system/Capabilities_as.cpp
      libcore/asobj/flash/system/IME_as.cpp
      libcore/asobj/flash/system/LoaderContext_as.cpp
      libcore/asobj/flash/system/SecurityDomain_as.cpp
      libcore/asobj/flash/system/SecurityPanel_as.cpp
      libcore/asobj/flash/system/Security_as.cpp
      libcore/asobj/flash/text/CSMSettings_as.cpp
      libcore/asobj/flash/text/FontStyle_as.cpp
      libcore/asobj/flash/text/FontType_as.cpp
      libcore/asobj/flash/text/StaticText_as.cpp
      libcore/asobj/flash/text/StyleSheet_as.cpp
      libcore/asobj/flash/text/TextFormat_as.cpp
      libcore/asobj/flash/text/TextLineMetrics_as.cpp
      libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp
      libcore/asobj/flash/ui/KeyLocation_as.cpp
      libcore/asobj/flash/utils/Dictionary_as.cpp
      libcore/asobj/flash/utils/Endian_as.cpp
      libcore/asobj/flash/utils/Proxy_as.cpp
      libcore/asobj/flash/utils/Timer_as.cpp
    ------------------------------------------------------------
    revno: 11248.1.57
    committer: Benjamin Wolsey <address@hidden>
    branch nick: temp
    timestamp: Wed 2009-07-15 11:33:59 +0200
    message:
      Fix more compiler warnings.
    modified:
      libcore/asobj/flash/accessibility/AccessibilityProperties_as.cpp
      libcore/asobj/flash/accessibility/Accessibility_as.cpp
      libcore/asobj/flash/desktop/ClipboardTransferMode_as.cpp
      libcore/asobj/flash/desktop/Clipboard_as.cpp
      libcore/asobj/flash/display/AVM1Movie_as.cpp
      libcore/asobj/flash/display/Bitmap_as.cpp
      libcore/asobj/flash/display/BlendMode_as.cpp
      libcore/asobj/flash/display/DisplayObject_as.cpp
      libcore/asobj/flash/display/FrameLabel_as.cpp
      libcore/asobj/flash/display/Graphics_as.cpp
      libcore/asobj/flash/display/IBitmapDrawable_as.cpp
      libcore/asobj/flash/display/InteractiveObject_as.cpp
      libcore/asobj/flash/display/LoaderInfo_as.cpp
      libcore/asobj/flash/display/Loader_as.cpp
      libcore/asobj/flash/display/MorphShape_as.cpp
      libcore/asobj/flash/display/Scene_as.cpp
      libcore/asobj/flash/display/Shape_as.cpp
      libcore/asobj/flash/display/SimpleButton_as.cpp
      libcore/asobj/flash/display/Sprite_as.cpp
      libcore/asobj/flash/errors/EOFError_as.cpp
      libcore/asobj/flash/errors/IOError_as.cpp
      libcore/asobj/flash/errors/IllegalOperationError_as.cpp
      libcore/asobj/flash/errors/InvalidSWFError_as.cpp
      libcore/asobj/flash/errors/MemoryError_as.cpp
      libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp
      libcore/asobj/flash/errors/StackOverflowError_as.cpp
      libcore/asobj/flash/events/ActivityEvent_as.cpp
      libcore/asobj/flash/events/ContextMenuEvent_as.cpp
      libcore/asobj/flash/events/DataEvent_as.cpp
      libcore/asobj/flash/events/ErrorEvent_as.cpp
      libcore/asobj/flash/events/EventDispatcher_as.cpp
      libcore/asobj/flash/events/EventPhase_as.cpp
      libcore/asobj/flash/events/Event_as.cpp
      libcore/asobj/flash/events/FocusEvent_as.cpp
      libcore/asobj/flash/events/FullScreenEvent_as.cpp
      libcore/asobj/flash/events/HTTPStatusEvent_as.cpp
      libcore/asobj/flash/events/IEventDispatcher_as.cpp
      libcore/asobj/flash/events/IMEEvent_as.cpp
      libcore/asobj/flash/events/IOErrorEvent_as.cpp
      libcore/asobj/flash/events/KeyboardEvent_as.cpp
      libcore/asobj/flash/events/MouseEvent_as.cpp
      libcore/asobj/flash/events/NetStatusEvent_as.cpp
      libcore/asobj/flash/events/ProgressEvent_as.cpp
      libcore/asobj/flash/events/SecurityErrorEvent_as.cpp
      libcore/asobj/flash/events/StatusEvent_as.cpp
      libcore/asobj/flash/events/SyncEvent_as.cpp
      libcore/asobj/flash/events/TextEvent_as.cpp
      libcore/asobj/flash/events/TimerEvent_as.cpp
      libcore/asobj/flash/filters/DisplacementMapFilterMode_as.cpp
      libcore/asobj/flash/flash_pkg.cpp
      libcore/asobj/flash/media/ID3Info_as.cpp
      libcore/asobj/flash/media/SoundChannel_as.cpp
      libcore/asobj/flash/media/SoundLoaderContext_as.cpp
      libcore/asobj/flash/media/SoundMixer_as.cpp
      libcore/asobj/flash/media/SoundTransform_as.cpp
      libcore/asobj/flash/media/Video_as.cpp
      libcore/asobj/flash/media/media_as.cpp
      libcore/asobj/flash/net/FileFilter_as.cpp
      libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp
      libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp
      libcore/asobj/flash/net/NetConnection_as.cpp
      libcore/asobj/flash/net/NetStream_as.cpp
      libcore/asobj/flash/net/ObjectEncoding_as.cpp
      libcore/asobj/flash/net/Responder_as.cpp
      libcore/asobj/flash/net/Socket_as.cpp
      libcore/asobj/flash/net/URLLoader_as.cpp
      libcore/asobj/flash/net/URLRequestHeader_as.cpp
      libcore/asobj/flash/net/URLRequestMethod_as.cpp
      libcore/asobj/flash/net/URLRequest_as.cpp
      libcore/asobj/flash/net/URLStream_as.cpp
      libcore/asobj/flash/net/URLVariables_as.cpp
      libcore/asobj/flash/printing/PrintJobOptions_as.cpp
      libcore/asobj/flash/printing/PrintJob_as.cpp
      libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp
      libcore/asobj/flash/sampler/NewObjectSample_as.cpp
      libcore/asobj/flash/sampler/Sample_as.cpp
      libcore/asobj/flash/sampler/StackFrame_as.cpp
      libcore/asobj/flash/system/ApplicationDomain_as.cpp
      libcore/asobj/flash/system/Capabilities_as.cpp
      libcore/asobj/flash/system/IMEConversionMode_as.cpp
      libcore/asobj/flash/system/IME_as.cpp
      libcore/asobj/flash/system/LoaderContext_as.cpp
      libcore/asobj/flash/system/SecurityDomain_as.cpp
      libcore/asobj/flash/system/SecurityPanel_as.cpp
      libcore/asobj/flash/system/Security_as.cpp
      libcore/asobj/flash/text/AntiAliasType_as.cpp
      libcore/asobj/flash/text/CSMSettings_as.cpp
      libcore/asobj/flash/text/FontStyle_as.cpp
      libcore/asobj/flash/text/FontType_as.cpp
      libcore/asobj/flash/text/Font_as.cpp
      libcore/asobj/flash/text/StaticText_as.cpp
      libcore/asobj/flash/text/StyleSheet_as.cpp
      libcore/asobj/flash/text/TextField_as.cpp
      libcore/asobj/flash/text/TextFormat_as.cpp
      libcore/asobj/flash/text/TextLineMetrics_as.cpp
      libcore/asobj/flash/text/text_pkg.cpp
      libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp
      libcore/asobj/flash/ui/KeyLocation_as.cpp
      libcore/asobj/flash/utils/ByteArray_as.cpp
      libcore/asobj/flash/utils/Dictionary_as.cpp
      libcore/asobj/flash/utils/Endian_as.cpp
      libcore/asobj/flash/utils/IDataInput_as.cpp
      libcore/asobj/flash/utils/IDataOutput_as.cpp
      libcore/asobj/flash/utils/IExternalizable_as.cpp
      libcore/asobj/flash/utils/Proxy_as.cpp
      libcore/asobj/flash/utils/Timer_as.cpp
=== modified file 'extensions/gtk2/gtkext.cpp'
--- a/extensions/gtk2/gtkext.cpp        2009-07-14 13:40:32 +0000
+++ b/extensions/gtk2/gtkext.cpp        2009-07-14 15:40:58 +0000
@@ -112,7 +112,7 @@
     args->push_back(event);
     args->push_back(handler);
 
-    as_object obj = val.to_object();
+    as_object obj = val.to_object(*getGlobal(fn));
 
     // Call the AS function defined in the source file using this extension
     (*as_func)(fn_call(&obj, &env, args));
@@ -228,7 +228,7 @@
     boost::intrusive_ptr<GtkExt> ptr = ensureType<GtkExt>(fn.this_ptr);
 
     if (fn.nargs > 0) {
-       GtkExt *window = dynamic_cast<GtkExt *>(fn.arg(0).to_object().get());
+       GtkExt *window = dynamic_cast<GtkExt 
*>(fn.arg(0).to_object(*getGlobal(fn)).get());
        string name = fn.arg(1).to_string();
        as_value func = fn.arg(2).to_as_function();
        //int data = fn.arg(3).to_int();
@@ -251,7 +251,7 @@
     boost::intrusive_ptr<GtkExt> ptr = ensureType<GtkExt>(fn.this_ptr);
     
     if (fn.nargs > 0) {
-       GtkExt *window = dynamic_cast<GtkExt *>(fn.arg(0).to_object().get());
+       GtkExt *window = dynamic_cast<GtkExt 
*>(fn.arg(0).to_object(*getGlobal(fn)).get());
        int width = fn.arg(1).to_int();
        window->container_set_border_width(width);
        dbglogfile << "set container border width to " << width << " !" << endl;
@@ -291,11 +291,11 @@
     boost::intrusive_ptr<GtkExt> ptr = ensureType<GtkExt>(fn.this_ptr);
 
     if (fn.nargs > 0) {
-       GtkExt *parent = dynamic_cast<GtkExt *>(fn.arg(0).to_object().get());
+       GtkExt *parent = dynamic_cast<GtkExt 
*>(fn.arg(0).to_object(*getGlobal(fn)).get());
        string name = (fn.arg(1).to_string());
-       GtkExt *child = dynamic_cast<GtkExt *>(fn.arg(3).to_object().get());
+       GtkExt *child = dynamic_cast<GtkExt 
*>(fn.arg(3).to_object(*getGlobal(fn)).get());
 // currently unused
-//     as_value *callback = dynamic_cast<as_value *>(fn.arg(2).to_object());
+//     as_value *callback = dynamic_cast<as_value 
*>(fn.arg(2).to_object(*getGlobal(fn)));
 
        // FIXME: This seems to cause an Gobject warning
        g_signal_connect_swapped (G_OBJECT (child->getWindow()), name.c_str(),
@@ -312,8 +312,8 @@
     boost::intrusive_ptr<GtkExt> ptr = ensureType<GtkExt>(fn.this_ptr);
     
     if (fn.nargs > 0) {
-       GtkExt *parent = dynamic_cast<GtkExt *>(fn.arg(0).to_object().get());
-       GtkExt *child = dynamic_cast<GtkExt *>(fn.arg(1).to_object().get());
+       GtkExt *parent = dynamic_cast<GtkExt 
*>(fn.arg(0).to_object(*getGlobal(fn)).get());
+       GtkExt *child = dynamic_cast<GtkExt 
*>(fn.arg(1).to_object(*getGlobal(fn)).get());
        gtk_container_add (GTK_CONTAINER (parent->getWindow()), 
child->getWindow());
        return as_value(true);
     }
@@ -326,7 +326,7 @@
     boost::intrusive_ptr<GtkExt> ptr = ensureType<GtkExt>(fn.this_ptr);
      
     if (fn.nargs > 0) {
-       GtkExt *window = dynamic_cast<GtkExt *>(fn.arg(0).to_object().get());
+       GtkExt *window = dynamic_cast<GtkExt 
*>(fn.arg(0).to_object(*getGlobal(fn)).get());
        gtk_widget_show(window->getWindow());
     }
     return as_value();

=== modified file 'extensions/mysql/mysql_db.cpp'
--- a/extensions/mysql/mysql_db.cpp     2009-07-14 13:40:32 +0000
+++ b/extensions/mysql/mysql_db.cpp     2009-07-14 15:40:58 +0000
@@ -326,7 +326,7 @@
 
     if (fn.nargs > 0) {
        string sql = fn.arg(0).to_string();
-       Array_as *arr = (Array_as *)fn.arg(1).to_object().get();
+       Array_as *arr = (Array_as *)fn.arg(1).to_object(*getGlobal(fn)).get();
 //     std::vector< std::vector<const char *> >
        MySQL::query_t qresult;
 #if 0

=== modified file 'libcore/ClassHierarchy.cpp'
--- a/libcore/ClassHierarchy.cpp        2009-07-14 06:01:56 +0000
+++ b/libcore/ClassHierarchy.cpp        2009-07-15 09:10:56 +0000
@@ -24,6 +24,7 @@
 #include "as_function.h"
 #include "builtin_function.h"
 #include "asClass.h"
+#include "Global_as.h"
 #include "Object.h"
 #include "extension.h"
 
@@ -72,7 +73,6 @@
         mTarget(g),
         mExtension(e)
     {
-        init_member("constructor", 
as_function::getFunctionConstructor().get());
     }
 
     virtual as_value operator()(const fn_call& fn)
@@ -107,12 +107,15 @@
         if (mExtension->initModuleWithFunc(mDeclaration.file_name,
             mDeclaration.init_name, *mTarget))
         {
+            Global_as& gl = *getGlobal(fn);
             // Successfully loaded it, now find it, set its proto, and return.
             as_value us;
             mTarget->get_member(mDeclaration.name, &us);
-            if (mDeclaration.super_name && 
!us.to_object()->hasOwnProperty(NSV::PROP_uuPROTOuu))
+            if (mDeclaration.super_name && 
+                    !us.to_object(gl)->hasOwnProperty(NSV::PROP_uuPROTOuu))
             {
-                
us.to_object()->set_prototype(super.to_as_function()->getPrototype());
+                us.to_object(gl)->set_prototype(
+                        super.to_as_function()->getPrototype());
             }
             return us;
         }
@@ -138,9 +141,6 @@
         mDeclaration(c),
         mTarget(g)
     {
-        // does it make any sense to set a 'constructor' here ??
-        //init_member("constructor", this);
-        //init_member("constructor", 
as_function::getFunctionConstructor().get());
     }
 
     virtual as_value operator()(const fn_call& fn)
@@ -179,14 +179,17 @@
                 }
                 assert(super.to_as_function());
             }
-            if (!us.to_object()) {
+
+            Global_as& gl = *getGlobal(fn);
+
+            if (!us.to_object(gl)) {
                 log_error("Native class %s is not an object after "
                         "initialization (%s)", st.value(mDeclaration.name), 
us);
             }
             if (mDeclaration.super_name &&
-                    !us.to_object()->hasOwnProperty(NSV::PROP_uuPROTOuu)) {
+                    !us.to_object(gl)->hasOwnProperty(NSV::PROP_uuPROTOuu)) {
                 
-                us.to_object()->set_prototype(
+                us.to_object(gl)->set_prototype(
                         super.to_as_function()->getPrototype());
             }
         }

=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp     2009-07-14 08:18:12 +0000
+++ b/libcore/MovieClip.cpp     2009-07-15 09:10:56 +0000
@@ -953,7 +953,7 @@
         return tmp.to_sprite(true);
     }
 
-    return tmp.to_object().get();
+    return tmp.to_object(*getGlobal(*this)).get();
 }
 
 bool

=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp     2009-07-14 19:08:54 +0000
+++ b/libcore/TextField.cpp     2009-07-15 10:09:37 +0000
@@ -2581,7 +2581,7 @@
                 "unhandled by Gnash", ss.str());
     }
 
-    as_object* obj = fn.arg(0).to_object().get();
+    as_object* obj = fn.arg(0).to_object(*getGlobal(fn)).get();
     if ( ! obj )
     {
         IF_VERBOSE_ASCODING_ERRORS(

=== modified file 'libcore/Video.cpp'
--- a/libcore/Video.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/Video.cpp 2009-07-14 15:33:46 +0000
@@ -436,7 +436,8 @@
        }
 
        boost::intrusive_ptr<NetStream_as> ns = 
-        boost::dynamic_pointer_cast<NetStream_as>(fn.arg(0).to_object());
+        boost::dynamic_pointer_cast<NetStream_as>(
+                fn.arg(0).to_object(*getGlobal(fn)));
        if (ns)
        {
                video->setStream(ns);

=== modified file 'libcore/asClass.cpp'
--- a/libcore/asClass.cpp       2009-07-14 06:01:56 +0000
+++ b/libcore/asClass.cpp       2009-07-15 09:10:56 +0000
@@ -26,6 +26,7 @@
 #include "namedStrings.h"
 #include "as_value.h"
 #include "asNamespace.h"
+#include "Global_as.h"
 
 #ifdef ENABLE_AVM2
 #include "asMethod.h"
@@ -40,8 +41,10 @@
         boost::uint32_t slotId, asClass *type, as_value& val, bool isconst,
         bool isstatic)
 {
-       if (val.is_object()) {
-               val.to_object()->set_member(NSV::INTERNAL_TYPE, 
+    Global_as* g = VM::get().getGlobal();
+
+    if (val.is_object()) {
+               val.to_object(*g)->set_member(NSV::INTERNAL_TYPE, 
                        std::size_t(type->getName()));
     }
 

=== modified file 'libcore/asMethod.cpp'
--- a/libcore/asMethod.cpp      2009-07-14 06:01:56 +0000
+++ b/libcore/asMethod.cpp      2009-07-15 09:10:56 +0000
@@ -23,6 +23,7 @@
 #include "asClass.h"
 #include "CodeStream.h"
 #include "abc_function.h"
+#include "Global_as.h"
 #include "VM.h"
 
 namespace gnash {
@@ -83,8 +84,9 @@
 asMethod::addValue(string_table::key name, asNamespace *ns,
         boost::uint32_t slotId, asClass *type, as_value& val, bool isconst)
 {
+    Global_as* g = VM::get().getGlobal();
        if (val.is_object()) {
-               val.to_object()->set_member(NSV::INTERNAL_TYPE,
+               val.to_object(*g)->set_member(NSV::INTERNAL_TYPE,
                 size_t(type->getName()));
     }
 

=== modified file 'libcore/as_environment.cpp'
--- a/libcore/as_environment.cpp        2009-07-14 07:23:01 +0000
+++ b/libcore/as_environment.cpp        2009-07-14 15:33:46 +0000
@@ -1089,6 +1089,12 @@
     return env.getVM().getRoot();
 }
 
+Global_as*
+getGlobal(const as_environment& env)
+{
+    return env.getVM().getGlobal();
+}
+
 int
 getSWFVersion(const as_environment& env)
 {

=== modified file 'libcore/as_environment.h'
--- a/libcore/as_environment.h  2009-07-14 06:01:56 +0000
+++ b/libcore/as_environment.h  2009-07-14 15:33:46 +0000
@@ -35,6 +35,8 @@
 // Forward declarations
 class DisplayObject;
 class VM;
+class Global_as;
+class movie_root;
 
 /// ActionScript execution environment.
 class as_environment
@@ -679,6 +681,7 @@
 movie_root& getRoot(const as_environment& env);
 string_table& getStringTable(const as_environment& env);
 int getSWFVersion(const as_environment& env);
+Global_as* getGlobal(const as_environment &env);
 
 } // end namespace gnash
 

=== modified file 'libcore/as_function.cpp'
--- a/libcore/as_function.cpp   2009-07-14 08:54:39 +0000
+++ b/libcore/as_function.cpp   2009-07-14 15:33:46 +0000
@@ -116,7 +116,7 @@
        //               prototype, not the old !!
        as_value proto;
        get_member(NSV::PROP_PROTOTYPE, &proto);
-       return proto.to_object();
+       return proto.to_object(*VM::get().getGlobal());
 }
 
 boost::intrusive_ptr<builtin_function>
@@ -175,7 +175,7 @@
                     "%s", ex.what());
                }
 
-               if (ret.is_object()) newobj = ret.to_object();
+               if (ret.is_object()) newobj = ret.to_object(*getGlobal(env));
                else {
                        log_debug("Native function called as constructor 
returned %s", ret);
                        newobj = new as_object();
@@ -215,7 +215,7 @@
                );
 
                // Create an empty object, with a ref to the constructor's 
prototype.
-               newobj = new as_object(proto.to_object());
+               newobj = new as_object(proto.to_object(*getGlobal(env)));
 
                // Add a __constructor__ member to the new object, but only for 
SWF6 up
                // (to be checked)
@@ -329,7 +329,7 @@
        else
        {
                // Get the object to use as 'this' reference
-               as_object* obj = fn.arg(0).to_object().get();
+               as_object* obj = fn.arg(0).to_object(*getGlobal(fn)).get();
 
         if (!obj) obj = new as_object; 
 
@@ -349,7 +349,9 @@
                                }
                        );
 
-                       boost::intrusive_ptr<as_object> arg1 = 
fn.arg(1).to_object();
+                       boost::intrusive_ptr<as_object> arg1 = 
+                fn.arg(1).to_object(*getGlobal(fn));
+
                        if (!arg1) {
                                IF_VERBOSE_ASCODING_ERRORS(
                                        log_aserror(_("Second arg of 
Function.apply"
@@ -410,7 +412,8 @@
        else {
                // Get the object to use as 'this' reference
                as_value this_val = fn.arg(0);
-               boost::intrusive_ptr<as_object> this_ptr = this_val.to_object();
+               boost::intrusive_ptr<as_object> this_ptr =
+            this_val.to_object(*getGlobal(fn));
 
                if (!this_ptr) {
                        // If the first argument is not an object, we should

=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp     2009-07-14 08:11:29 +0000
+++ b/libcore/as_object.cpp     2009-07-15 09:10:56 +0000
@@ -830,7 +830,9 @@
 bool
 as_object::instanceOf(as_object* ctor)
 {
-//#define GNASH_DEBUG_INSTANCE_OF 1
+
+    /// An object is never an instance of a null prototype.
+    if (!ctor) return false;
 
        as_value protoVal;
        if ( ! ctor->get_member(NSV::PROP_PROTOTYPE, &protoVal) )
@@ -841,7 +843,7 @@
 #endif
                return false;
        }
-       as_object* ctorProto = protoVal.to_object().get();
+       as_object* ctorProto = protoVal.to_object(*getGlobal(*this)).get();
        if ( ! ctorProto )
        {
 #ifdef GNASH_DEBUG_INSTANCE_OF
@@ -1001,7 +1003,7 @@
                return;
        }
 
-       boost::intrusive_ptr<as_object> props = props_val.to_object();
+       boost::intrusive_ptr<as_object> props = 
props_val.to_object(*getGlobal(*this));
        Array_as* ary = dynamic_cast<Array_as*>(props.get());
        if ( ! ary )
        {
@@ -1148,7 +1150,7 @@
 boost::intrusive_ptr<as_object>
 as_object::get_prototype()
 {
-       int swfVersion = _vm.getSWFVersion();
+       int swfVersion = getSWFVersion(*this);
 
        Property* prop = _members.getProperty(NSV::PROP_uuPROTOuu);
        if ( ! prop ) return 0;
@@ -1156,7 +1158,7 @@
 
        as_value tmp = prop->getValue(*this);
 
-       return tmp.to_object();
+       return tmp.to_object(*getGlobal(*this));
 }
 
 bool
@@ -1304,7 +1306,7 @@
                return NULL;
        }
 
-       return tmp.to_object().get();
+       return tmp.to_object(*getGlobal(*this)).get();
 }
 
 void

=== modified file 'libcore/as_value.cpp'
--- a/libcore/as_value.cpp      2009-07-14 06:01:56 +0000
+++ b/libcore/as_value.cpp      2009-07-15 09:10:56 +0000
@@ -26,9 +26,6 @@
 #include "as_environment.h" // for MOVIECLIP values
 #include "VM.h" // for MOVIECLIP values
 #include "movie_root.h" // for MOVIECLIP values
-#include "String_as.h" // for automatic as_value::STRING => String
-#include "Number_as.h" // for automatic as_value::NUMBER => Number
-#include "Boolean_as.h" // for automatic as_value::BOOLEAN => Boolean
 #include "action.h" // for call_method0
 #include "utility.h" // for typeName() 
 #include "GnashNumeric.h"
@@ -41,6 +38,7 @@
 #include "Date_as.h" // for Date type (readAMF0)
 #include "SimpleBuffer.h"
 #include "StringPredicates.h"
+#include "Global_as.h"
 
 #include <boost/shared_ptr.hpp>
 #include <cmath> 
@@ -861,7 +859,7 @@
     VM& vm = VM::get();
     //int swfVersion = vm.getSWFVersion();
     boost::shared_ptr<amf::Element> el ( new amf::Element );
-    boost::intrusive_ptr<as_object> ptr = to_object();
+    boost::intrusive_ptr<as_object> ptr = to_object(*vm.getGlobal());
 
     switch (m_type) {
       case UNDEFINED:
@@ -1019,7 +1017,7 @@
        
 // Return value as an object.
 boost::intrusive_ptr<as_object>
-as_value::to_object() const
+as_value::to_object(Global_as& global) const
 {
        typedef boost::intrusive_ptr<as_object> ptr;
 
@@ -1032,18 +1030,16 @@
                        return getFun().get();
 
                case MOVIECLIP:
-                       // FIXME: update when to_sprite will return
-                       //        an intrusive_ptr directly
                        return ptr(toDisplayObject());
 
                case STRING:
-                       return init_string_instance(getStr());
+                       return global.createString(getStr());
 
                case NUMBER:
-                       return init_number_instance(getNum());
+                       return global.createNumber(getNum());
 
                case BOOLEAN:
-                       return init_boolean_instance(getBool());
+                       return global.createBoolean(getBool());
 
                default:
                        // Invalid to convert exceptions.
@@ -2527,7 +2523,7 @@
 
         case OBJECT:
         {
-            as_object* obj = to_object().get();
+            as_object* obj = to_object(*vm.getGlobal()).get();
             assert(obj);
             OffsetTable::iterator it = offsetTable.find(obj);
             if ( it == offsetTable.end() )

=== modified file 'libcore/as_value.h'
--- a/libcore/as_value.h        2009-04-05 22:01:27 +0000
+++ b/libcore/as_value.h        2009-07-15 09:10:56 +0000
@@ -45,6 +45,7 @@
 namespace gnash {
     class VM;
        class as_object;
+       class Global_as;
        class fn_call;
        class as_function;
        class MovieClip;
@@ -432,14 +433,17 @@
        /// as the returned object might be a newly allocated one in case
        /// of a conversion from a primitive string, number or boolean value.
        ///
-       /// string values will be converted to String objects,
-       /// numeric values will be converted to Number objects,
-       /// boolean values are currently NOT converted, but should (FIXME!)
+       /// string values are converted to String objects
+       /// numeric values are converted to Number objects
+       /// boolean values are converted to Boolean objects
        ///
        /// If you want to avoid the conversion, check with is_object() before
        /// calling this function.
-       ///
-       boost::intrusive_ptr<as_object> to_object() const;
+    //
+    /// @param global   The global object object for the conversion. This
+    ///                 contains the prototypes or constructors necessary for
+    ///                 conversion.
+       boost::intrusive_ptr<as_object> to_object(Global_as& global) const;
 
        /// Return value as a sprite or NULL if this is not possible.
        //

=== modified file 'libcore/asobj/Array_as.cpp'
--- a/libcore/asobj/Array_as.cpp        2009-07-14 10:56:15 +0000
+++ b/libcore/asobj/Array_as.cpp        2009-07-15 09:10:56 +0000
@@ -380,15 +380,13 @@
 class as_value_prop
 {
 public:
-    as_cmp_fn _comp;
-    string_table::key _prop;
     
     // Note: cmpfn must implement a strict weak ordering
-    as_value_prop(string_table::key name, 
-        as_cmp_fn cmpfn)
+    as_value_prop(string_table::key name, as_cmp_fn cmpfn, const as_object& o)
         :
         _comp(cmpfn),
-        _prop(name)
+        _prop(name),
+        _obj(o)
     {
     }
 
@@ -397,13 +395,17 @@
         as_value av, bv;
 
         // why do we cast ao/bo to objects here ?
-        boost::intrusive_ptr<as_object> ao = a.to_object();
-        boost::intrusive_ptr<as_object> bo = b.to_object();
+        boost::intrusive_ptr<as_object> ao = a.to_object(*getGlobal(_obj));
+        boost::intrusive_ptr<as_object> bo = b.to_object(*getGlobal(_obj));
         
         ao->get_member(_prop, &av);
         bo->get_member(_prop, &bv);
         return _comp(av, bv);
     }
+private:
+    as_cmp_fn _comp;
+    string_table::key _prop;
+    const as_object& _obj;
 };
 
 // Comparator for sorting on multiple array properties
@@ -415,13 +417,16 @@
 
     typedef std::deque<string_table::key> Props;
     Props& _prps;
+    
+    const as_object& _obj;
 
     // Note: all as_cmp_fns in *cmps must implement strict weak ordering
     as_value_multiprop(std::deque<string_table::key>& prps, 
-        std::deque<as_cmp_fn>& cmps)
+        std::deque<as_cmp_fn>& cmps, const as_object& o)
         :
         _cmps(cmps),
-        _prps(prps)
+        _prps(prps),
+        _obj(o)
     {
     }
 
@@ -432,8 +437,8 @@
         std::deque<as_cmp_fn>::iterator cmp = _cmps.begin();
 
         // why do we cast ao/bo to objects here ?
-        boost::intrusive_ptr<as_object> ao = a.to_object();
-        boost::intrusive_ptr<as_object> bo = b.to_object();
+        boost::intrusive_ptr<as_object> ao = a.to_object(*getGlobal(_obj));
+        boost::intrusive_ptr<as_object> bo = b.to_object(*getGlobal(_obj));
         
         for (Props::iterator pit = _prps.begin(), pend = _prps.end(); pit != 
pend; ++pit, ++cmp)
         {
@@ -457,8 +462,10 @@
 {
 public:
     as_value_multiprop_eq(std::deque<string_table::key>& prps, 
-        std::deque<as_cmp_fn>& cmps)
-        : as_value_multiprop(prps, cmps)
+        std::deque<as_cmp_fn>& cmps, const as_object& o)
+        :
+        as_value_multiprop(prps, cmps, o),
+        _obj(o)
     {
     }
 
@@ -469,8 +476,8 @@
         Comps::const_iterator cmp = _cmps.begin();
 
         // why do we cast ao/bo to objects here ?
-        boost::intrusive_ptr<as_object> ao = a.to_object();
-        boost::intrusive_ptr<as_object> bo = b.to_object();
+        boost::intrusive_ptr<as_object> ao = a.to_object(*getGlobal(_obj));
+        boost::intrusive_ptr<as_object> bo = b.to_object(*getGlobal(_obj));
 
         for (Props::iterator pit = _prps.begin(), pend = _prps.end(); pit != 
pend; ++pit, ++cmp)
         {
@@ -483,6 +490,8 @@
         
         return true;
     }
+private:
+    const as_object& _obj;
 };
 
 // Convenience function to strip fUniqueSort and fReturnIndexedArray from sort
@@ -1054,12 +1063,12 @@
             flags = static_cast<boost::uint8_t>(fn.arg(1).to_number());
             flags = flag_preprocess(flags, &do_unique, &do_index);
         }
-        as_value_prop avc = as_value_prop(propField, 
-                    get_basic_cmp(flags, version));
+        as_value_prop avc(propField, get_basic_cmp(flags, version),
+                *getGlobal(fn));
         if (do_unique)
         {
-            as_value_prop ave = as_value_prop(propField, 
-                get_basic_eq(flags, version));
+            as_value_prop ave(propField, get_basic_eq(flags, version), 
+                    *getGlobal(fn));
             if (do_index)
                 return array->sort_indexed(avc, ave);
             return array->sort(avc, ave);
@@ -1074,7 +1083,7 @@
     if (fn.nargs > 0 && fn.arg(0).is_object() ) 
     {
         boost::intrusive_ptr<Array_as> props = 
-            ensureType<Array_as>(fn.arg(0).to_object());
+            ensureType<Array_as>(fn.arg(0).to_object(*getGlobal(fn)));
         std::deque<string_table::key> prp;
         unsigned int optnum = props->size();
         std::deque<as_cmp_fn> cmp;
@@ -1098,7 +1107,7 @@
         else if ( fn.arg(1).is_object() )
         {
             boost::intrusive_ptr<Array_as> farray = 
-                ensureType<Array_as>(fn.arg(1).to_object());
+                ensureType<Array_as>(fn.arg(1).to_object(*getGlobal(fn)));
             if (farray->size() == optnum)
             {
                 Array_as::const_iterator 
@@ -1145,19 +1154,15 @@
             }
         }
 
-        as_value_multiprop avc = 
-            as_value_multiprop(prp, cmp);
+        as_value_multiprop avc(prp, cmp, *getGlobal(fn));
 
         if (do_unique)
         {
-            as_value_multiprop_eq ave = 
-                as_value_multiprop_eq(prp, eq);
-            if (do_index)
-                return array->sort_indexed(avc, ave);
+            as_value_multiprop_eq ave(prp, eq, *getGlobal(fn));
+            if (do_index) return array->sort_indexed(avc, ave);
             return array->sort(avc, ave);
         }
-        if (do_index)
-            return as_value(array->sort_indexed(avc));
+        if (do_index) return as_value(array->sort_indexed(avc));
         array->sort(avc);
         return as_value(array.get());
 
@@ -1310,7 +1315,9 @@
     for (unsigned int i=0; i<fn.nargs; i++)
     {
         // Array args get concatenated by elements
-        boost::intrusive_ptr<Array_as> other = 
boost::dynamic_pointer_cast<Array_as>(fn.arg(i).to_object());
+        boost::intrusive_ptr<Array_as> other =
+            boost::dynamic_pointer_cast<Array_as>(
+                    fn.arg(i).to_object(*getGlobal(fn)));
         if ( other )
         {
             newarray->concat(*other);

=== modified file 'libcore/asobj/AsBroadcaster.cpp'
--- a/libcore/asobj/AsBroadcaster.cpp   2009-07-14 10:50:49 +0000
+++ b/libcore/asobj/AsBroadcaster.cpp   2009-07-14 15:33:46 +0000
@@ -87,7 +87,7 @@
     /// Call a method on the given value
     void visit(as_value& v)
     {
-        boost::intrusive_ptr<as_object> o = v.to_object();
+        boost::intrusive_ptr<as_object> o = v.to_object(*getGlobal(_fn));
         if ( ! o ) return;
 
         as_value method;
@@ -222,7 +222,7 @@
         return as_value();
     }
 
-    boost::intrusive_ptr<as_object> tgt = tgtval.to_object();
+    boost::intrusive_ptr<as_object> tgt = tgtval.to_object(*getGlobal(fn));
     if ( ! tgt )
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -274,7 +274,8 @@
         return as_value(false); // TODO: check this
     }
 
-    boost::intrusive_ptr<as_object> listenersObj = listenersValue.to_object();
+    boost::intrusive_ptr<as_object> listenersObj =
+        listenersValue.to_object(*getGlobal(fn));
     assert(listenersObj);
 
     boost::intrusive_ptr<Array_as> listeners = 
boost::dynamic_pointer_cast<Array_as>(listenersObj);
@@ -330,7 +331,8 @@
         return as_value(false); // TODO: check this
     }
 
-    boost::intrusive_ptr<as_object> listenersObj = listenersValue.to_object();
+    boost::intrusive_ptr<as_object> listenersObj =
+        listenersValue.to_object(*getGlobal(fn));
     assert(listenersObj);
 
     as_value listenerToRemove; assert(listenerToRemove.is_undefined());
@@ -413,7 +415,8 @@
     }
 
     boost::intrusive_ptr<Array_as> listeners =
-        boost::dynamic_pointer_cast<Array_as>(listenersValue.to_object());
+        boost::dynamic_pointer_cast<Array_as>(
+                listenersValue.to_object(*getGlobal(fn)));
 
     if ( ! listeners )
     {

=== modified file 'libcore/asobj/Boolean_as.cpp'
--- a/libcore/asobj/Boolean_as.cpp      2009-07-14 09:11:14 +0000
+++ b/libcore/asobj/Boolean_as.cpp      2009-07-15 07:53:57 +0000
@@ -38,7 +38,7 @@
     as_value boolean_valueof(const fn_call& fn);
     as_value boolean_ctor(const fn_call& fn);
     void attachBooleanInterface(as_object& o);
-    boost::intrusive_ptr<builtin_function> getBooleanConstructor();
+    as_object* getBooleanClass(Global_as& g);
     as_object* getBooleanInterface();
 }
 
@@ -47,68 +47,64 @@
 
 public:
 
-       Boolean_as()
-               :
-               as_object(getBooleanInterface())
-       {}
+    Boolean_as()
+        :
+        as_object(getBooleanInterface())
+    {}
 
-       Boolean_as(bool val)
-               :
-               as_object(getBooleanInterface())
-       {
-               _val = val;
-       }
-       
+    Boolean_as(bool val)
+        :
+        as_object(getBooleanInterface())
+    {
+        _val = val;
+    }
+    
     bool value() const { return _val; }
 
 private:
 
-       bool _val;
-       
+    bool _val;
+    
 };
 
 // extern (used by Global.cpp)
 void boolean_class_init(as_object& global)
 {
-       // This is going to be the global Boolean "class"/"function"
-       boost::intrusive_ptr<builtin_function> cl=getBooleanConstructor();
+    // This is going to be the global Boolean "class"/"function"
+    boost::intrusive_ptr<as_object> cl = getBooleanClass(*getGlobal(global));
 
-       // Register _global.Boolean
-       global.init_member("Boolean", cl.get());
+    // Register _global.Boolean
+    global.init_member("Boolean", cl.get());
 
 }
 
-boost::intrusive_ptr<as_object>
-init_boolean_instance(bool val)
+as_object*
+init_boolean_instance(Global_as& g, bool val)
 {
-       boost::intrusive_ptr<builtin_function> cl = getBooleanConstructor();
-       as_environment env(VM::get());
-
-       std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value> 
);
-       args->push_back(val);
-       return cl->constructInstance(env, args);
+    boost::intrusive_ptr<as_object> cl = getBooleanClass(g);
+    as_function* ctor = cl->to_function();
+    if (!ctor) return 0;
+
+    as_environment env(getVM(g));
+
+    std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value> );
+    args->push_back(val);
+    return ctor->constructInstance(env, args).get();
 }
 
 
 namespace {
 
-boost::intrusive_ptr<builtin_function>
-getBooleanConstructor()
+as_object*
+getBooleanClass(Global_as& g)
 {
-       // This is going to be the global Boolean "class"/"function"
-       static boost::intrusive_ptr<builtin_function> cl;
-
-       if ( cl == NULL )
-       {
-               cl=new builtin_function(&boolean_ctor, getBooleanInterface());
-               VM::get().addStatic(cl.get());
-
-               // replicate all interface to class, to be able to access
-               // all methods as static functions
-               //attachBooleanInterface(*cl);
-       }
-
-       return cl;
+    static as_object* cl = 0;
+
+    if (!cl) {
+        cl = g.createClass(&boolean_ctor, getBooleanInterface());
+        VM::get().addStatic(cl);
+    }
+    return cl;
 }
 
 void
@@ -116,31 +112,31 @@
 {
     Global_as* gl = getGlobal(o);
 
-       o.init_member("toString", gl->createFunction(boolean_tostring));
-       o.init_member("valueOf", gl->createFunction(boolean_valueof));
+    o.init_member("toString", gl->createFunction(boolean_tostring));
+    o.init_member("valueOf", gl->createFunction(boolean_valueof));
 }
 
 as_object*
 getBooleanInterface()
 {
-       static boost::intrusive_ptr<as_object> o;
-       if ( ! o )
-       {
-               o = new as_object(getObjectInterface());
-               VM::get().addStatic(o.get());
+    static boost::intrusive_ptr<as_object> o;
+    if ( ! o )
+    {
+        o = new as_object(getObjectInterface());
+        VM::get().addStatic(o.get());
 
-               attachBooleanInterface(*o);
-       }
-       return o.get();
+        attachBooleanInterface(*o);
+    }
+    return o.get();
 }
 
 
 as_value
 boolean_tostring(const fn_call& fn)
 {
-       boost::intrusive_ptr<Boolean_as> obj = 
ensureType<Boolean_as>(fn.this_ptr);
-       
-       if (obj->value()) return as_value("true");
+    boost::intrusive_ptr<Boolean_as> obj = ensureType<Boolean_as>(fn.this_ptr);
+    
+    if (obj->value()) return as_value("true");
 
     return as_value("false");
 }
@@ -149,24 +145,24 @@
 as_value
 boolean_valueof(const fn_call& fn) 
 {
-       boost::intrusive_ptr<Boolean_as> obj = 
ensureType<Boolean_as>(fn.this_ptr);
+    boost::intrusive_ptr<Boolean_as> obj = ensureType<Boolean_as>(fn.this_ptr);
 
-       return as_value(obj->value());
+    return as_value(obj->value());
 }
 
 as_value
 boolean_ctor(const fn_call& fn)
 {
-       if (fn.nargs > 0)
-       {
-               bool val = fn.arg(0).to_bool();
-               if ( ! fn.isInstantiation() ) return as_value(val);
+    if (fn.nargs > 0)
+    {
+        bool val = fn.arg(0).to_bool();
+        if ( ! fn.isInstantiation() ) return as_value(val);
         
         return as_value(new Boolean_as(val));
-       }
+    }
 
-       if (!fn.isInstantiation()) return as_value();
-               
+    if (!fn.isInstantiation()) return as_value();
+        
     return as_value(new Boolean_as(false));
 
 }

=== modified file 'libcore/asobj/Boolean_as.h'
--- a/libcore/asobj/Boolean_as.h        2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/Boolean_as.h        2009-07-14 16:15:25 +0000
@@ -24,12 +24,13 @@
 namespace gnash {
 
 class as_object;
+class Global_as;
 
 /// Initialize the global Boolean class
 void boolean_class_init(as_object& global);
 
 /// Return a Boolean instance (in case the core lib needs it)
-boost::intrusive_ptr<as_object> init_boolean_instance(bool val);
+as_object* init_boolean_instance(Global_as& g, bool val);
   
 } // end of gnash namespace
 

=== modified file 'libcore/asobj/Color_as.cpp'
--- a/libcore/asobj/Color_as.cpp        2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/Color_as.cpp        2009-07-14 15:33:46 +0000
@@ -302,7 +302,7 @@
                return as_value();
        }
 
-       boost::intrusive_ptr<as_object> trans = fn.arg(0).to_object();
+       boost::intrusive_ptr<as_object> trans = 
fn.arg(0).to_object(*getGlobal(fn));
        if ( ! trans )
        {
                IF_VERBOSE_ASCODING_ERRORS(

=== modified file 'libcore/asobj/Global_as.h'
--- a/libcore/asobj/Global_as.h 2009-07-14 08:54:39 +0000
+++ b/libcore/asobj/Global_as.h 2009-07-14 16:15:25 +0000
@@ -45,8 +45,6 @@
 #define GNASH_GLOBAL_H
 
 #include "as_object.h" // for inheritance
-#include "extension.h"
-#include "ClassHierarchy.h"
 
 // Forward declarations
 namespace gnash {
@@ -87,6 +85,12 @@
     /// an object (the prototype) with a constructor.
     virtual as_object* createClass(ASFunction ctor, as_object* prototype) = 0;
 
+    virtual as_object* createString(const std::string& s) = 0;
+
+    virtual as_object* createNumber(double d) = 0;
+
+    virtual as_object* createBoolean(bool b) = 0;
+
     virtual Global_as& global() {
         return *this;
     }

=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2009-07-14 10:49:07 +0000
+++ b/libcore/asobj/Globals.cpp 2009-07-14 16:15:25 +0000
@@ -191,6 +191,24 @@
 
 }
 
+as_object*
+AVM1Global::createString(const std::string& s)
+{
+    return init_string_instance(*this, s);
+}
+
+as_object*
+AVM1Global::createNumber(double d)
+{
+    return init_number_instance(*this, d);
+}
+
+as_object*
+AVM1Global::createBoolean(bool b)
+{
+    return init_boolean_instance(*this, b);
+}
+
 builtin_function*
 AVM2Global::createFunction(Global_as::ASFunction function)
 {
@@ -205,6 +223,24 @@
     return new builtin_function(ctor, prototype);
 }
 
+as_object*
+AVM2Global::createString(const std::string& s)
+{
+    return init_string_instance(*this, s);
+}
+
+as_object*
+AVM2Global::createNumber(double d)
+{
+    return init_number_instance(*this, d);
+}
+
+as_object*
+AVM2Global::createBoolean(bool b)
+{
+    return init_boolean_instance(*this, b);
+}
+
 void 
 AVM1Global::markReachableResources() const
 {
@@ -777,7 +813,7 @@
     );
     
     // object
-    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object(*getGlobal(fn));
     if ( ! obj ) {
         IF_VERBOSE_ASCODING_ERRORS(
         log_aserror(_("Invalid call to ASSetPropFlags: "
@@ -930,7 +966,7 @@
 
        unsigned timer_arg = 1;
 
-       boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+       boost::intrusive_ptr<as_object> obj = 
fn.arg(0).to_object(*getGlobal(fn));
        if ( ! obj )
        {
                IF_VERBOSE_ASCODING_ERRORS(
@@ -1003,7 +1039,7 @@
 
        unsigned timer_arg = 1;
 
-       boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+       boost::intrusive_ptr<as_object> obj = 
fn.arg(0).to_object(*getGlobal(fn));
        if (!obj) {
                IF_VERBOSE_ASCODING_ERRORS(
                        std::stringstream ss; fn.dump_args(ss);
@@ -1099,6 +1135,7 @@
     vm.registerNative(global_setInterval, 250, 0);
     vm.registerNative(global_clearInterval, 250, 1);
 
+    registerStringNative(global);
     registerArrayNative(global);
     registerMovieClipNative(global);
     registerSelectionNative(global);

=== modified file 'libcore/asobj/Globals.h'
--- a/libcore/asobj/Globals.h   2009-07-14 09:48:53 +0000
+++ b/libcore/asobj/Globals.h   2009-07-14 15:33:46 +0000
@@ -66,15 +66,21 @@
 
     void registerClasses();
 
-    const ClassHierarchy& classHierarchy() const {
-        return _classes;
-    }
-    
-    ClassHierarchy& classHierarchy() {
-        return _classes;
-    }
-
-    VM& getVM() const {
+    virtual as_object* createString(const std::string& s);
+
+    virtual as_object* createNumber(double d);
+
+    virtual as_object* createBoolean(bool b);
+    
+    virtual const ClassHierarchy& classHierarchy() const {
+        return _classes;
+    }
+    
+    virtual ClassHierarchy& classHierarchy() {
+        return _classes;
+    }
+
+    virtual VM& getVM() const {
         return _vm;
     }
     
@@ -90,7 +96,7 @@
 
 protected:
     
-    void markReachableResources() const;
+    virtual void markReachableResources() const;
 
 private:
 
@@ -122,21 +128,27 @@
     virtual as_object* createClass(Global_as::ASFunction ctor,
             as_object* prototype);
 
-    const ClassHierarchy& classHierarchy() const {
-        return _classes;
-    }
-    
-    ClassHierarchy& classHierarchy() {
-        return _classes;
-    }
-    
-    VM& getVM() const {
+    virtual as_object* createString(const std::string& s);
+
+    virtual as_object* createNumber(double d);
+
+    virtual as_object* createBoolean(bool b);
+
+    virtual const ClassHierarchy& classHierarchy() const {
+        return _classes;
+    }
+    
+    virtual ClassHierarchy& classHierarchy() {
+        return _classes;
+    }
+    
+    virtual VM& getVM() const {
         return _vm;
     }
 
 protected:
 
-    void markReachableResources() const {
+    virtual void markReachableResources() const {
         _classes.markReachableResources();
         markAsObjectReachable();
     }

=== modified file 'libcore/asobj/LoadableObject.cpp'
--- a/libcore/asobj/LoadableObject.cpp  2009-07-14 08:18:12 +0000
+++ b/libcore/asobj/LoadableObject.cpp  2009-07-15 09:10:56 +0000
@@ -30,6 +30,7 @@
 #include "utf8.h"
 #include "fn_call.h"
 #include "GnashAlgorithm.h"
+#include "Global_as.h"
 
 #include <sstream>
 #include <map>
@@ -104,7 +105,7 @@
             /// Read in our custom headers if they exist and are an
             /// array.
             Array_as* array = dynamic_cast<Array_as*>(
-                            customHeaders.to_object().get());
+                            customHeaders.to_object(*getGlobal(target)).get());
                             
             if (array)
             {
@@ -334,7 +335,7 @@
 
     if (ptr->get_member(NSV::PROP_uCUSTOM_HEADERS, &customHeaders))
     {
-        array = customHeaders.to_object().get();
+        array = customHeaders.to_object(*getGlobal(fn)).get();
         if (!array)
         {
             IF_VERBOSE_ASCODING_ERRORS(
@@ -369,7 +370,8 @@
     {
         // This must be an array. Keys / values are pushed in valid
         // pairs to the _customHeaders array.    
-        boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+        boost::intrusive_ptr<as_object> obj =
+            fn.arg(0).to_object(*getGlobal(fn));
         Array_as* headerArray = dynamic_cast<Array_as*>(obj.get());
 
         if (!headerArray)
@@ -501,7 +503,8 @@
        }
 
 
-       boost::intrusive_ptr<as_object> target = fn.arg(1).to_object();
+       boost::intrusive_ptr<as_object> target =
+        fn.arg(1).to_object(*getGlobal(fn));
 
     // According to the Flash 8 Cookbook (Joey Lott, Jeffrey Bardzell), p 427,
     // this method sends by GET unless overridden, and always by GET in the

=== modified file 'libcore/asobj/MovieClipLoader.cpp'
--- a/libcore/asobj/MovieClipLoader.cpp 2009-07-14 11:02:24 +0000
+++ b/libcore/asobj/MovieClipLoader.cpp 2009-07-14 15:33:46 +0000
@@ -362,7 +362,7 @@
                return as_value();
        }
 
-       boost::intrusive_ptr<as_object> target = fn.arg(0).to_object();
+       boost::intrusive_ptr<as_object> target = 
fn.arg(0).to_object(*getGlobal(fn));
   
        if ( ! target.get() )
        {

=== modified file 'libcore/asobj/NetConnection_as.cpp'
--- a/libcore/asobj/NetConnection_as.cpp        2009-07-14 10:38:40 +0000
+++ b/libcore/asobj/NetConnection_as.cpp        2009-07-14 15:33:46 +0000
@@ -1073,7 +1073,7 @@
     if (fn.nargs > 1) {
 
         if (fn.arg(1).is_object()) {
-            asCallback = (fn.arg(1).to_object());
+            asCallback = (fn.arg(1).to_object(*getGlobal(fn)));
         }
         else {
             IF_VERBOSE_ASCODING_ERRORS(

=== modified file 'libcore/asobj/NetStream_as.cpp'
--- a/libcore/asobj/NetStream_as.cpp    2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/NetStream_as.cpp    2009-07-14 15:33:46 +0000
@@ -1595,7 +1595,7 @@
     {
         boost::intrusive_ptr<NetConnection_as> ns =
             boost::dynamic_pointer_cast<NetConnection_as>(
-                    fn.arg(0).to_object());
+                    fn.arg(0).to_object(*getGlobal(fn)));
         if ( ns )
         {
             netstream_obj->setNetCon(ns);

=== modified file 'libcore/asobj/Number_as.cpp'
--- a/libcore/asobj/Number_as.cpp       2009-07-14 09:11:14 +0000
+++ b/libcore/asobj/Number_as.cpp       2009-07-15 07:54:33 +0000
@@ -37,38 +37,39 @@
 
 namespace {
     as_object* getNumberInterface();
+    as_object* getNumberClass();
 }
 
 class Number_as : public as_object
 {
-       // the number value
-       double _val;
+    // the number value
+    double _val;
 
 public:
 
-       Number_as(double val=0.0)
-               :
-               as_object(getNumberInterface()),
-               _val(val)
-       {
-       }
-
-       // override from as_object
-       std::string get_text_value() const
-       {
-               return as_value::doubleToString(_val);
-       }
-
-       // override from as_object
-       double get_numeric_value() const
-       {
-               return _val;
-       }
-
-       as_value get_primitive_value() const 
-       {
-               return _val;
-       }
+    Number_as(double val = 0.0)
+        :
+        as_object(getNumberInterface()),
+        _val(val)
+    {
+    }
+
+    // override from as_object
+    std::string get_text_value() const
+    {
+        return as_value::doubleToString(_val);
+    }
+
+    // override from as_object
+    double get_numeric_value() const
+    {
+        return _val;
+    }
+
+    as_value get_primitive_value() const 
+    {
+        return _val;
+    }
 
 };
 
@@ -77,57 +78,57 @@
 as_value
 number_toString(const fn_call& fn)
 {
-       // Number.toString must only work for number object, not generic ones.
-       // This is so trace(Number.prototype) doesn't return 0 ...
-       boost::intrusive_ptr<Number_as> obj = 
ensureType<Number_as>(fn.this_ptr);
-
-       double val = obj->get_numeric_value();
-       unsigned radix = 10;
-
-       if ( fn.nargs ) 
-       {
-               int userRadix = fn.arg(0).to_int();
-               if ( userRadix >= 2 && userRadix <= 36 ) radix=userRadix;
-               else
-               {
-                       IF_VERBOSE_ASCODING_ERRORS(
-                       log_aserror(_("Number.toString(%s): "
-                               "radix must be in the 2..36 range (%d is 
invalid)"),
-                               fn.arg(0), userRadix)
-                       )
-               }
-
-       }
-       return as_value::doubleToString(val, radix); 
+    // Number.toString must only work for number object, not generic ones.
+    // This is so trace(Number.prototype) doesn't return 0 ...
+    boost::intrusive_ptr<Number_as> obj = ensureType<Number_as>(fn.this_ptr);
+
+    double val = obj->get_numeric_value();
+    unsigned radix = 10;
+
+    if ( fn.nargs ) 
+    {
+        int userRadix = fn.arg(0).to_int();
+        if ( userRadix >= 2 && userRadix <= 36 ) radix=userRadix;
+        else
+        {
+            IF_VERBOSE_ASCODING_ERRORS(
+            log_aserror(_("Number.toString(%s): "
+                "radix must be in the 2..36 range (%d is invalid)"),
+                fn.arg(0), userRadix)
+            )
+        }
+
+    }
+    return as_value::doubleToString(val, radix); 
 }
 
 as_value
 number_valueOf(const fn_call& fn)
 {
-       // Number.valueOf must only work for number object, not generic ones.
-       // This is so trace(Number.prototype == Object) return true in swf5 ?
-       boost::intrusive_ptr<Number_as> obj = 
ensureType<Number_as>(fn.this_ptr);
+    // Number.valueOf must only work for number object, not generic ones.
+    // This is so trace(Number.prototype == Object) return true in swf5 ?
+    boost::intrusive_ptr<Number_as> obj = ensureType<Number_as>(fn.this_ptr);
 
-       return obj->get_primitive_value();
+    return obj->get_primitive_value();
 }
 
 as_value
 number_ctor(const fn_call& fn)
 {
-       double val = 0;
-       if (fn.nargs > 0)
-       {
-               val = fn.arg(0).to_number();
-       }
-
-       if ( ! fn.isInstantiation() )
-       {
-               return as_value(val);
-       }
-
-       Number_as* obj = new Number_as(val);
-       
-       return as_value(obj); // will keep alive
+    double val = 0;
+    if (fn.nargs > 0)
+    {
+        val = fn.arg(0).to_number();
+    }
+
+    if ( ! fn.isInstantiation() )
+    {
+        return as_value(val);
+    }
+
+    Number_as* obj = new Number_as(val);
+    
+    return as_value(obj); // will keep alive
 }
 
 void
@@ -135,9 +136,9 @@
 {
     Global_as* gl = getGlobal(o);
 
-       o.init_member("toString", gl->createFunction(number_toString));
+    o.init_member("toString", gl->createFunction(number_toString));
 
-       o.init_member("valueOf", gl->createFunction(number_valueOf));
+    o.init_member("valueOf", gl->createFunction(number_valueOf));
 }
 
 void
@@ -163,33 +164,32 @@
             as_value(-std::numeric_limits<double>::infinity()), cflags);
 }
 
-boost::intrusive_ptr<builtin_function> 
-getNumberConstructor()
+as_object*
+getNumberClass(Global_as& g)
 {
-       // This is going to be the global Number "class"/"function"
-       static boost::intrusive_ptr<builtin_function> cl=NULL;
+    // This is going to be the global Number "class"/"function"
+    static as_object* cl = 0;
 
-       if ( cl == NULL )
-       {
-               cl=new builtin_function(&number_ctor, getNumberInterface());
+    if (!cl) {
+        cl = g.createClass(&number_ctor, getNumberInterface());
         attachNumberStaticInterface(*cl);
-               VM::get().addStatic(cl.get());
-       }
+        VM::get().addStatic(cl);
+    }
 
-       return cl;
+    return cl;
 }
 
 as_object*
 getNumberInterface()
 {
-       static boost::intrusive_ptr<as_object> o=NULL;
-       if ( o == NULL )
-       {
-               o = new as_object(getObjectInterface());
+    static boost::intrusive_ptr<as_object> o=NULL;
+    if ( o == NULL )
+    {
+        o = new as_object(getObjectInterface());
         attachNumberInterface(*o);
-       }
+    }
 
-       return o.get();
+    return o.get();
 }
 
 
@@ -199,24 +199,26 @@
 // extern (used by Global.cpp)
 void number_class_init(as_object& global)
 {
-       boost::intrusive_ptr<builtin_function> cl=getNumberConstructor();
+    boost::intrusive_ptr<as_object> cl = getNumberClass(*getGlobal(global));
 
-       // Register _global.Number
-       global.init_member("Number", cl.get());
+    // Register _global.Number
+    global.init_member("Number", cl.get());
 
 }
 
-boost::intrusive_ptr<as_object>
-init_number_instance(double val)
+as_object*
+init_number_instance(Global_as& g, double val)
 {
-       boost::intrusive_ptr<builtin_function> cl=getNumberConstructor();
-
-       as_environment env(VM::get());
-
-       std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value> 
);
-       args->push_back(val);
-
-       return cl->constructInstance(env, args);
+    boost::intrusive_ptr<as_object> cl = getNumberClass(g);
+    as_function* ctor = cl->to_function();
+    if (!ctor) return 0;
+
+    as_environment env(getVM(g));
+
+    std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value> );
+    args->push_back(val);
+
+    return ctor->constructInstance(env, args).get();
 }
 
   

=== modified file 'libcore/asobj/Number_as.h'
--- a/libcore/asobj/Number_as.h 2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/Number_as.h 2009-07-14 16:15:25 +0000
@@ -27,12 +27,13 @@
 namespace gnash {
 
 class as_object;
+class Global_as;
 
 /// Initialize the global Number class
 void number_class_init(as_object& global);
 
 /// Return a Number instance
-boost::intrusive_ptr<as_object> init_number_instance(double val);
+as_object* init_number_instance(Global_as& g, double val);
 
 }
 

=== modified file 'libcore/asobj/Object.cpp'
--- a/libcore/asobj/Object.cpp  2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/Object.cpp  2009-07-14 15:33:46 +0000
@@ -148,7 +148,7 @@
        if ( fn.nargs == 1 ) // copy constructor
        {
 
-        as_object* obj = fn.arg(0).to_object().get();
+        as_object* obj = fn.arg(0).to_object(*getGlobal(fn)).get();
 
         /// If it's not an object, return an undefined object, not null.
         if (!obj) return as_value(new as_object);
@@ -415,7 +415,7 @@
                return as_value(false); 
        }
 
-       boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+       boost::intrusive_ptr<as_object> obj = 
fn.arg(0).to_object(*getGlobal(fn));
        if ( ! obj )
        {
                IF_VERBOSE_ASCODING_ERRORS(

=== modified file 'libcore/asobj/Selection_as.cpp'
--- a/libcore/asobj/Selection_as.cpp    2009-07-14 09:11:14 +0000
+++ b/libcore/asobj/Selection_as.cpp    2009-07-14 15:33:46 +0000
@@ -236,7 +236,8 @@
     }
     else {
         /// Try converting directly to DisplayObject.
-        ch = dynamic_cast<DisplayObject*>(focus.to_object().get());
+        ch = dynamic_cast<DisplayObject*>(
+                focus.to_object(*getGlobal(fn)).get());
     }
 
     // If the argument does not resolve to a DisplayObject, do nothing.

=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp       2009-07-14 09:11:14 +0000
+++ b/libcore/asobj/String_as.cpp       2009-07-14 16:15:25 +0000
@@ -69,7 +69,7 @@
     size_t validIndex(const std::wstring& subject, int index);
     void attachStringInterface(as_object& o);
     as_object* getStringInterface();
-    boost::intrusive_ptr<builtin_function> getStringConstructor();
+    as_object* getStringConstructor(Global_as& gl);
 
     inline bool checkArgs(const fn_call& fn, size_t min, size_t max,
             const std::string& function);
@@ -110,55 +110,76 @@
     std::string _string;
 };
 
-boost::intrusive_ptr<as_object>
-init_string_instance(const std::string& val)
+as_object*
+init_string_instance(Global_as& g, const std::string& val)
 {
-       // TODO: get VM from the environment ?
-       VM& vm = VM::get();
-
-       // TODO: get the environment passed in !!
-       as_environment env(vm);
-
-       int swfVersion = vm.getSWFVersion();
-
-       boost::intrusive_ptr<as_function> cl;
+       as_environment env(getVM(g));
+
+       int swfVersion = getSWFVersion(g);
+
+       boost::intrusive_ptr<as_function> ctor;
 
        if ( swfVersion < 6 ) {
-               cl = getStringConstructor();
+               as_object* sc = getStringConstructor(g);
+        if (sc) ctor = sc->to_function();
        }
        else {
-               as_object* global = vm.getGlobal();
                as_value clval;
-               if ( ! global->get_member(NSV::CLASS_STRING, &clval) ) {
+
+               if (!g.get_member(NSV::CLASS_STRING, &clval) ) {
                        log_debug("UNTESTED: String instantiation requested but 
"
                     "_global doesn't contain a 'String' symbol. Returning "
                     "the NULL object.");
-                       return cl;
+                       return ctor.get();
                }
-               else if ( ! clval.is_function() ) {
+               else if (!clval.is_function()) {
                        log_debug("UNTESTED: String instantiation requested but 
"
                     "_global.String is not a function (%s). Returning "
                     "the NULL object.", clval);
-                       return cl;
+                       return ctor.get();
                }
                else {
-                       cl = clval.to_as_function();
-                       assert(cl);
+                       ctor = clval.to_as_function();
                }
        }
 
+    if (!ctor.get()) return ctor.get();
+
        std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value> 
);
        args->push_back(val);
-       boost::intrusive_ptr<as_object> ret = cl->constructInstance(env, args);
-
-       return ret;
+       boost::intrusive_ptr<as_object> ret = ctor->constructInstance(env, 
args);
+
+       return ret.get();
+}
+
+void registerStringNative(as_object& global)
+{
+    VM& vm = getVM(global);
+       vm.registerNative(as_object::tostring_method, 251, 1);
+       vm.registerNative(string_toString, 251, 2);
+       vm.registerNative(string_oldToUpper, 102, 0);
+       vm.registerNative(string_toUpperCase, 251, 3);
+       vm.registerNative(string_oldToLower, 102, 1);
+       vm.registerNative(string_toLowerCase, 251, 4);
+       vm.registerNative(string_charAt, 251, 5);
+       vm.registerNative(string_charCodeAt, 251, 6);
+       vm.registerNative(string_concat, 251, 7);
+       vm.registerNative(string_indexOf, 251, 8);
+       vm.registerNative(string_lastIndexOf, 251, 9);
+       vm.registerNative(string_slice, 251, 10);
+       vm.registerNative(string_substring, 251, 11);
+       vm.registerNative(string_split, 251, 12);
+       vm.registerNative(string_substr, 251, 13);
+    vm.registerNative(string_fromCharCode, 251, 14);
 }
 
 // extern (used by Global.cpp)
-void string_class_init(as_object& global)
+void
+string_class_init(as_object& global)
 {
     // This is going to be the global String "class"/"function"
-    boost::intrusive_ptr<builtin_function> cl = getStringConstructor();
+    boost::intrusive_ptr<as_object> cl =
+        getStringConstructor(*getGlobal(global));
 
     // Register _global.String (should be only visible from SWF5 up)
     // TODO: register as ASnative(251, 0)
@@ -176,60 +197,18 @@
 {
        VM& vm = getVM(o);
 
-       // ASnative(251, 1) - [String.prototype] valueOf
-       vm.registerNative(as_object::tostring_method, 251, 1);
        o.init_member("valueOf", vm.getNative(251, 1));
-
-       // ASnative(251, 2) - [String.prototype] toString
-       vm.registerNative(string_toString, 251, 2);
        o.init_member("toString", vm.getNative(251, 2));
-
-       // ASnative(251, 3) - [String.prototype] toUpperCase
-       // ASnative(102, 0) - SWF5 to upper.
-       vm.registerNative(string_oldToUpper, 102, 0);
-       vm.registerNative(string_toUpperCase, 251, 3);
        o.init_member("toUpperCase", vm.getNative(251, 3));
-
-       // ASnative(251, 4) - [String.prototype] toLowerCase
-       // ASnative(102, 1) - SWF5 to lower.
-       vm.registerNative(string_oldToLower, 102, 1);
-       vm.registerNative(string_toLowerCase, 251, 4);
        o.init_member("toLowerCase", vm.getNative(251, 4));
-
-       // ASnative(251, 5) - [String.prototype] charAt
-       vm.registerNative(string_charAt, 251, 5);
        o.init_member("charAt", vm.getNative(251, 5));
-
-       // ASnative(251, 6) - [String.prototype] charCodeAt
-       vm.registerNative(string_charCodeAt, 251, 6);
        o.init_member("charCodeAt", vm.getNative(251, 6));
-
-       // ASnative(251, 7) - [String.prototype] concat
-       vm.registerNative(string_concat, 251, 7);
        o.init_member("concat", vm.getNative(251, 7));
-
-       // ASnative(251, 8) - [String.prototype] indexOf
-       vm.registerNative(string_indexOf, 251, 8);
        o.init_member("indexOf", vm.getNative(251, 8));
-
-       // ASnative(251, 9) - [String.prototype] lastIndexOf
-       vm.registerNative(string_lastIndexOf, 251, 9);
        o.init_member("lastIndexOf", vm.getNative(251, 9));
-
-       // ASnative(251, 10) - [String.prototype] slice
-       vm.registerNative(string_slice, 251, 10);
        o.init_member("slice", vm.getNative(251, 10));
-
-       // ASnative(251, 11) - [String.prototype] substring
-       vm.registerNative(string_substring, 251, 11);
        o.init_member("substring", vm.getNative(251, 11));
-
-       // ASnative(251, 12) - [String.prototype] split
-       vm.registerNative(string_split, 251, 12);
        o.init_member("split", vm.getNative(251, 12));
-
-       // ASnative(251, 13) - [String.prototype] substr
-       vm.registerNative(string_substr, 251, 13);
        o.init_member("substr", vm.getNative(251, 13));
 }
 
@@ -886,24 +865,16 @@
        return as_value(obj.get());
 }
 
-boost::intrusive_ptr<builtin_function>
-getStringConstructor()
+as_object*
+getStringConstructor(Global_as& gl)
 {
     // This is going to be the global String "class"/"function"
 
-    static boost::intrusive_ptr<builtin_function> cl;
-
-    if ( cl == NULL )
-    {
-           VM& vm = VM::get();
-
-        cl=new builtin_function(&string_ctor, getStringInterface());
-           vm.addStatic(cl.get());
-
-           // ASnative(251, 14) - [String] fromCharCode 
-           vm.registerNative(string_fromCharCode, 251, 14);
-           cl->init_member("fromCharCode", vm.getNative(251, 14)); 
-
+    static as_object* cl = 0;
+
+    if (!cl) {
+        cl = gl.createClass(&string_ctor, getStringInterface());
+           cl->init_member("fromCharCode", getVM(gl).getNative(251, 14)); 
     }
 
     return cl;

=== modified file 'libcore/asobj/String_as.h'
--- a/libcore/asobj/String_as.h 2009-02-25 22:33:03 +0000
+++ b/libcore/asobj/String_as.h 2009-07-14 16:15:25 +0000
@@ -25,6 +25,7 @@
 namespace gnash {
 
 class as_object;
+class Global_as;
 
 // Initialize the global String class
 void string_class_init(as_object& global);
@@ -36,7 +37,9 @@
 /// In the second case, not finding a proper constructor might result in
 /// returning the NULL object.
 ///
-boost::intrusive_ptr<as_object> init_string_instance(const std::string& val);
+as_object* init_string_instance(Global_as& g, const std::string& val);
+
+void registerStringNative(as_object& global);
 
 }
 

=== modified file 
'libcore/asobj/flash/accessibility/AccessibilityProperties_as.cpp'
--- a/libcore/asobj/flash/accessibility/AccessibilityProperties_as.cpp  
2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/accessibility/AccessibilityProperties_as.cpp  
2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachAccessibilityPropertiesInterface(as_object& o)
+attachAccessibilityPropertiesInterface(as_object& /*o*/)
 {
 }
 
 void
-attachAccessibilityPropertiesStaticInterface(as_object& o)
+attachAccessibilityPropertiesStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-accessibilityproperties_ctor(const fn_call& fn)
+accessibilityproperties_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new AccessibilityProperties_as;
 

=== modified file 'libcore/asobj/flash/accessibility/Accessibility_as.cpp'
--- a/libcore/asobj/flash/accessibility/Accessibility_as.cpp    2009-07-14 
09:11:14 +0000
+++ b/libcore/asobj/flash/accessibility/Accessibility_as.cpp    2009-07-15 
09:33:59 +0000
@@ -79,21 +79,20 @@
     // For swf v9 or greater, the isActive() method has been changed to a
     // the property "active".
     if ( vm.getSWFVersion() >= 9 ) {
-       o.init_member("active", gl->createFunction(Accessibility_active), 
flags);
+    o.init_member("active", gl->createFunction(Accessibility_active), flags);
     } else {
-       o.init_member("isActive", gl->createFunction(Accessibility_isActive), 
flags);
-       o.init_member("sendEvent", gl->createFunction(Accessibility_sendEvent), 
flags);
+    o.init_member("isActive", gl->createFunction(Accessibility_isActive), 
flags);
+    o.init_member("sendEvent", gl->createFunction(Accessibility_sendEvent), 
flags);
     }
     
-    o.init_member("updateProperties", 
gl->createFunction(Accessibility_updateProperties), flags);
+    o.init_member("updateProperties",
+            gl->createFunction(Accessibility_updateProperties), flags);
 
 }
 
 void
-attachAccessibilityStaticInterface(as_object& o)
+attachAccessibilityStaticInterface(as_object& /*o*/)
 {
-    Global_as* gl = getGlobal(o);
-
 }
 
 as_object*
@@ -108,7 +107,7 @@
 }
 
 as_value
-accessibility_ctor(const fn_call& fn)
+accessibility_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Accessibility_as;
 
@@ -119,19 +118,19 @@
 as_value
 Accessibility_isActive(const fn_call& fn)
 {
-       boost::intrusive_ptr<as_object> ptr = 
ensureType<as_object>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+    boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
+    UNUSED(ptr);
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
 }
 
 as_value
-Accessibility_active(const fn_call& fn)
+Accessibility_active(const fn_call& /*fn*/)
 {
     GNASH_REPORT_FUNCTION;
     
-//     boost::intrusive_ptr<as_object> ptr = 
ensureType<as_object>(fn.this_ptr);
-//     UNUSED(ptr);
+//     boost::intrusive_ptr<as_object> ptr = 
ensureType<as_object>(fn.this_ptr);
+//     UNUSED(ptr);
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value(false);
 }

=== modified file 'libcore/asobj/flash/desktop/ClipboardTransferMode_as.cpp'
--- a/libcore/asobj/flash/desktop/ClipboardTransferMode_as.cpp  2009-07-14 
09:11:14 +0000
+++ b/libcore/asobj/flash/desktop/ClipboardTransferMode_as.cpp  2009-07-15 
09:33:59 +0000
@@ -52,7 +52,6 @@
 void
 attachClipboardTransferModeStaticInterface(as_object& o)
 {
-    Global_as* gl = getGlobal(o);
     o.init_member("CLONE_ONLY", "cloneOnly");
     o.init_member("CLONE_PREFERRED", "clonePreferred");
     o.init_member("ORIGINAL_ONLY", "originalOnly");

=== modified file 'libcore/asobj/flash/desktop/Clipboard_as.cpp'
--- a/libcore/asobj/flash/desktop/Clipboard_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/desktop/Clipboard_as.cpp      2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachClipboardInterface(as_object& o)
+attachClipboardInterface(as_object& /*o*/)
 {
 }
 
 void
-attachClipboardStaticInterface(as_object& o)
+attachClipboardStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-clipboard_ctor(const fn_call& fn)
+clipboard_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Clipboard_as;
 

=== modified file 'libcore/asobj/flash/display/AVM1Movie_as.cpp'
--- a/libcore/asobj/flash/display/AVM1Movie_as.cpp      2009-07-14 12:25:24 
+0000
+++ b/libcore/asobj/flash/display/AVM1Movie_as.cpp      2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachAVM1MovieInterface(as_object& o)
+attachAVM1MovieInterface(as_object& /*o*/)
 {
 }
 
 void
-attachAVM1MovieStaticInterface(as_object& o)
+attachAVM1MovieStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-avm1movie_ctor(const fn_call& fn)
+avm1movie_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new AVM1Movie_as;
 

=== modified file 'libcore/asobj/flash/display/BitmapData_as.cpp'
--- a/libcore/asobj/flash/display/BitmapData_as.cpp     2009-07-14 10:34:17 
+0000
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp     2009-07-14 15:33:46 
+0000
@@ -377,7 +377,7 @@
     }
 
     // This can be any object with the right properties.   
-    as_object* obj = arg.to_object().get();
+    as_object* obj = arg.to_object(*getGlobal(fn)).get();
     assert(obj);
     
     as_value x, y, w, h;

=== modified file 'libcore/asobj/flash/display/Bitmap_as.cpp'
--- a/libcore/asobj/flash/display/Bitmap_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/display/Bitmap_as.cpp 2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachBitmapInterface(as_object& o)
+attachBitmapInterface(as_object& /*o*/)
 {
 }
 
 void
-attachBitmapStaticInterface(as_object& o)
+attachBitmapStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-bitmap_ctor(const fn_call& fn)
+bitmap_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Bitmap_as;
 

=== modified file 'libcore/asobj/flash/display/BlendMode_as.cpp'
--- a/libcore/asobj/flash/display/BlendMode_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/display/BlendMode_as.cpp      2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachBlendModeInterface(as_object& o)
+attachBlendModeInterface(as_object& /*o*/)
 {
 }
 
 void
-attachBlendModeStaticInterface(as_object& o)
+attachBlendModeStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-blendmode_ctor(const fn_call& fn)
+blendmode_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new BlendMode_as;
 

=== modified file 'libcore/asobj/flash/display/DisplayObjectContainer_as.cpp'
--- a/libcore/asobj/flash/display/DisplayObjectContainer_as.cpp 2009-07-14 
12:25:24 +0000
+++ b/libcore/asobj/flash/display/DisplayObjectContainer_as.cpp 2009-07-14 
15:33:46 +0000
@@ -144,7 +144,7 @@
         );
     }
 
-    as_object* objArg = fn.arg(0).to_object().get();
+    as_object* objArg = fn.arg(0).to_object(*getGlobal(fn)).get();
     if (!objArg) {
         IF_VERBOSE_ASCODING_ERRORS(
         std::stringstream ss; fn.dump_args(ss);
@@ -190,7 +190,7 @@
         );
     }
 
-    as_object* objArg = fn.arg(0).to_object().get();
+    as_object* objArg = fn.arg(0).to_object(*getGlobal(fn)).get();
     if (!objArg) {
         IF_VERBOSE_ASCODING_ERRORS(
         std::stringstream ss; fn.dump_args(ss);

=== modified file 'libcore/asobj/flash/display/DisplayObject_as.cpp'
--- a/libcore/asobj/flash/display/DisplayObject_as.cpp  2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/display/DisplayObject_as.cpp  2009-07-15 09:33:59 
+0000
@@ -98,7 +98,7 @@
 }
 
 void
-attachDisplayObjectStaticInterface(as_object& o)
+attachDisplayObjectStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -224,7 +224,7 @@
 }
 
 as_value
-displayobject_ctor(const fn_call& fn)
+displayobject_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new DisplayObject_as;
 

=== modified file 'libcore/asobj/flash/display/FrameLabel_as.cpp'
--- a/libcore/asobj/flash/display/FrameLabel_as.cpp     2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/display/FrameLabel_as.cpp     2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachFrameLabelInterface(as_object& o)
+attachFrameLabelInterface(as_object& /*o*/)
 {
 }
 
 void
-attachFrameLabelStaticInterface(as_object& o)
+attachFrameLabelStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-framelabel_ctor(const fn_call& fn)
+framelabel_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new FrameLabel_as;
 

=== modified file 'libcore/asobj/flash/display/Graphics_as.cpp'
--- a/libcore/asobj/flash/display/Graphics_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/display/Graphics_as.cpp       2009-07-15 09:33:59 
+0000
@@ -247,7 +247,7 @@
 }
 
 as_value
-graphics_ctor(const fn_call& fn)
+graphics_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Graphics_as;
 

=== modified file 'libcore/asobj/flash/display/IBitmapDrawable_as.cpp'
--- a/libcore/asobj/flash/display/IBitmapDrawable_as.cpp        2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/display/IBitmapDrawable_as.cpp        2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachIBitmapDrawableInterface(as_object& o)
+attachIBitmapDrawableInterface(as_object& /*o*/)
 {
 }
 
 void
-attachIBitmapDrawableStaticInterface(as_object& o)
+attachIBitmapDrawableStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-ibitmapdrawable_ctor(const fn_call& fn)
+ibitmapdrawable_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IBitmapDrawable_as;
 

=== modified file 'libcore/asobj/flash/display/InteractiveObject_as.cpp'
--- a/libcore/asobj/flash/display/InteractiveObject_as.cpp      2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/display/InteractiveObject_as.cpp      2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachInteractiveObjectInterface(as_object& o)
+attachInteractiveObjectInterface(as_object& /*o*/)
 {
 }
 
 void
-attachInteractiveObjectStaticInterface(as_object& o)
+attachInteractiveObjectStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-interactiveobject_ctor(const fn_call& fn)
+interactiveobject_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new InteractiveObject_as;
 

=== modified file 'libcore/asobj/flash/display/LoaderInfo_as.cpp'
--- a/libcore/asobj/flash/display/LoaderInfo_as.cpp     2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/display/LoaderInfo_as.cpp     2009-07-15 09:33:59 
+0000
@@ -89,7 +89,7 @@
 }
 
 void
-attachLoaderInfoStaticInterface(as_object& o)
+attachLoaderInfoStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -175,7 +175,7 @@
 }
 
 as_value
-loaderinfo_ctor(const fn_call& fn)
+loaderinfo_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new LoaderInfo_as;
 

=== modified file 'libcore/asobj/flash/display/Loader_as.cpp'
--- a/libcore/asobj/flash/display/Loader_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/display/Loader_as.cpp 2009-07-15 09:33:59 +0000
@@ -128,7 +128,7 @@
 }
 
 as_value
-loader_ctor(const fn_call& fn)
+loader_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Loader_as;
 

=== modified file 'libcore/asobj/flash/display/MorphShape_as.cpp'
--- a/libcore/asobj/flash/display/MorphShape_as.cpp     2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/display/MorphShape_as.cpp     2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachMorphShapeInterface(as_object& o)
+attachMorphShapeInterface(as_object& /*o*/)
 {
 }
 
 void
-attachMorphShapeStaticInterface(as_object& o)
+attachMorphShapeStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-morphshape_ctor(const fn_call& fn)
+morphshape_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new MorphShape_as;
 

=== modified file 'libcore/asobj/flash/display/MovieClip_as.cpp'
--- a/libcore/asobj/flash/display/MovieClip_as.cpp      2009-07-14 10:34:17 
+0000
+++ b/libcore/asobj/flash/display/MovieClip_as.cpp      2009-07-15 08:23:37 
+0000
@@ -129,8 +129,10 @@
         static boost::intrusive_ptr<as_object> cl =
             new as_object(getMovieClipAS3Interface());
         
+        // TODO: fix AVM2Global::createClass to work for AVM2.
+        Global_as* gl = getGlobal(where);
         cl->init_member(NSV::PROP_CONSTRUCTOR,
-                new builtin_function(movieclip_as3_ctor));
+                gl->createFunction(movieclip_as3_ctor));
 
         log_debug("AVM2 MovieClip, proto %s", cl);
 
@@ -596,7 +598,7 @@
     boost::intrusive_ptr<as_object> initObj;
 
     if (fn.nargs > 3 ) {
-        initObj = fn.arg(3).to_object();
+        initObj = fn.arg(3).to_object(*getGlobal(fn));
         if (!initObj) {
             // This is actually a valid thing to do,
             // the documented behaviour is to just NOT
@@ -636,7 +638,7 @@
         return as_value();
     }
 
-    as_object* obj = fn.arg(0).to_object().get();
+    as_object* obj = fn.arg(0).to_object(*getGlobal(fn)).get();
     if ( ! obj )
     { 
         std::stringstream ss; fn.dump_args(ss);
@@ -907,7 +909,7 @@
     // Copy members from initObject
     if (fn.nargs == 3)
     {
-        boost::intrusive_ptr<as_object> initObject = fn.arg(2).to_object();
+        boost::intrusive_ptr<as_object> initObject = 
fn.arg(2).to_object(*getGlobal(fn));
         ch = movieclip->duplicateMovieClip(newname, depthValue,
                 initObject.get());
     }
@@ -1388,7 +1390,7 @@
     if (!fn.nargs) return as_value(MovieClip::METHOD_NONE); 
 
     const as_value& v = fn.arg(0);
-    boost::intrusive_ptr<as_object> o = v.to_object();
+    boost::intrusive_ptr<as_object> o = v.to_object(*getGlobal(fn));
     if ( ! o )
     {
         log_debug(_("meth(%s): first argument doesn't cast to object"), v);
@@ -1504,7 +1506,7 @@
         return ret;
     }
 
-    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object(*getGlobal(fn));
     if ( ! obj )
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -1567,7 +1569,7 @@
         return ret;
     }
 
-    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object(*getGlobal(fn));
     if ( ! obj )
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -1640,7 +1642,7 @@
     else
     {
 
-        boost::intrusive_ptr<as_object> obj ( arg.to_object() );
+        boost::intrusive_ptr<as_object> obj ( arg.to_object(*getGlobal(fn)) );
         DisplayObject* mask = dynamic_cast<DisplayObject*>(obj.get());
         if ( ! mask )
         {
@@ -2147,10 +2149,10 @@
 
     typedef boost::intrusive_ptr<as_object> ObjPtr;
 
-    ObjPtr colors = fn.arg(1).to_object();
-    ObjPtr alphas = fn.arg(2).to_object();
-    ObjPtr ratios = fn.arg(3).to_object();
-    ObjPtr matrixArg = fn.arg(4).to_object();
+    ObjPtr colors = fn.arg(1).to_object(*getGlobal(fn));
+    ObjPtr alphas = fn.arg(2).to_object(*getGlobal(fn));
+    ObjPtr ratios = fn.arg(3).to_object(*getGlobal(fn));
+    ObjPtr matrixArg = fn.arg(4).to_object(*getGlobal(fn));
 
     if ( ! colors || ! alphas || ! ratios || ! matrixArg )
     {
@@ -2490,7 +2492,7 @@
         return as_value();
     }
 
-    as_object* obj = fn.arg(0).to_object().get();
+    as_object* obj = fn.arg(0).to_object(*getGlobal(fn)).get();
     boost::intrusive_ptr<BitmapData_as> bd = dynamic_cast<BitmapData_as*>(obj);
 
     if (!bd) {

=== modified file 'libcore/asobj/flash/display/Scene_as.cpp'
--- a/libcore/asobj/flash/display/Scene_as.cpp  2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/display/Scene_as.cpp  2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachSceneInterface(as_object& o)
+attachSceneInterface(as_object& /*o*/)
 {
 }
 
 void
-attachSceneStaticInterface(as_object& o)
+attachSceneStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-scene_ctor(const fn_call& fn)
+scene_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Scene_as;
 

=== modified file 'libcore/asobj/flash/display/Shape_as.cpp'
--- a/libcore/asobj/flash/display/Shape_as.cpp  2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/display/Shape_as.cpp  2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachShapeInterface(as_object& o)
+attachShapeInterface(as_object& /*o*/)
 {
 }
 
 void
-attachShapeStaticInterface(as_object& o)
+attachShapeStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-shape_ctor(const fn_call& fn)
+shape_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Shape_as;
 

=== modified file 'libcore/asobj/flash/display/SimpleButton_as.cpp'
--- a/libcore/asobj/flash/display/SimpleButton_as.cpp   2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/display/SimpleButton_as.cpp   2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachSimpleButtonInterface(as_object& o)
+attachSimpleButtonInterface(as_object& /*o*/)
 {
 }
 
 void
-attachSimpleButtonStaticInterface(as_object& o)
+attachSimpleButtonStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-simplebutton_ctor(const fn_call& fn)
+simplebutton_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new SimpleButton_as;
 

=== modified file 'libcore/asobj/flash/display/Sprite_as.cpp'
--- a/libcore/asobj/flash/display/Sprite_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/display/Sprite_as.cpp 2009-07-15 09:33:59 +0000
@@ -103,7 +103,7 @@
 }
 
 as_value
-sprite_ctor(const fn_call& fn)
+sprite_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Sprite_as;
 

=== modified file 'libcore/asobj/flash/errors/EOFError_as.cpp'
--- a/libcore/asobj/flash/errors/EOFError_as.cpp        2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/errors/EOFError_as.cpp        2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachEOFErrorInterface(as_object& o)
+attachEOFErrorInterface(as_object& /*o*/)
 {
 }
 
 void
-attachEOFErrorStaticInterface(as_object& o)
+attachEOFErrorStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-eoferror_ctor(const fn_call& fn)
+eoferror_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new EOFError_as;
 

=== modified file 'libcore/asobj/flash/errors/IOError_as.cpp'
--- a/libcore/asobj/flash/errors/IOError_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/errors/IOError_as.cpp 2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachIOErrorInterface(as_object& o)
+attachIOErrorInterface(as_object& /*o*/)
 {
 }
 
 void
-attachIOErrorStaticInterface(as_object& o)
+attachIOErrorStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-ioerror_ctor(const fn_call& fn)
+ioerror_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IOError_as;
 

=== modified file 'libcore/asobj/flash/errors/IllegalOperationError_as.cpp'
--- a/libcore/asobj/flash/errors/IllegalOperationError_as.cpp   2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/errors/IllegalOperationError_as.cpp   2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachIllegalOperationErrorInterface(as_object& o)
+attachIllegalOperationErrorInterface(as_object& /*o*/)
 {
 }
 
 void
-attachIllegalOperationErrorStaticInterface(as_object& o)
+attachIllegalOperationErrorStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-illegaloperationerror_ctor(const fn_call& fn)
+illegaloperationerror_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IllegalOperationError_as;
 

=== modified file 'libcore/asobj/flash/errors/InvalidSWFError_as.cpp'
--- a/libcore/asobj/flash/errors/InvalidSWFError_as.cpp 2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/errors/InvalidSWFError_as.cpp 2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachInvalidSWFErrorInterface(as_object& o)
+attachInvalidSWFErrorInterface(as_object& /*o*/)
 {
 }
 
 void
-attachInvalidSWFErrorStaticInterface(as_object& o)
+attachInvalidSWFErrorStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-invalidswferror_ctor(const fn_call& fn)
+invalidswferror_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new InvalidSWFError_as;
 

=== modified file 'libcore/asobj/flash/errors/MemoryError_as.cpp'
--- a/libcore/asobj/flash/errors/MemoryError_as.cpp     2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/errors/MemoryError_as.cpp     2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachMemoryErrorInterface(as_object& o)
+attachMemoryErrorInterface(as_object& /*o*/)
 {
 }
 
 void
-attachMemoryErrorStaticInterface(as_object& o)
+attachMemoryErrorStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-memoryerror_ctor(const fn_call& fn)
+memoryerror_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new MemoryError_as;
 

=== modified file 'libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp'
--- a/libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp      2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/errors/ScriptTimeoutError_as.cpp      2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachScriptTimeoutErrorInterface(as_object& o)
+attachScriptTimeoutErrorInterface(as_object& /*o*/)
 {
 }
 
 void
-attachScriptTimeoutErrorStaticInterface(as_object& o)
+attachScriptTimeoutErrorStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-scripttimeouterror_ctor(const fn_call& fn)
+scripttimeouterror_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ScriptTimeoutError_as;
 

=== modified file 'libcore/asobj/flash/errors/StackOverflowError_as.cpp'
--- a/libcore/asobj/flash/errors/StackOverflowError_as.cpp      2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/errors/StackOverflowError_as.cpp      2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachStackOverflowErrorInterface(as_object& o)
+attachStackOverflowErrorInterface(as_object& /*o*/)
 {
 }
 
 void
-attachStackOverflowErrorStaticInterface(as_object& o)
+attachStackOverflowErrorStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-stackoverflowerror_ctor(const fn_call& fn)
+stackoverflowerror_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new StackOverflowError_as;
 

=== modified file 'libcore/asobj/flash/events/ActivityEvent_as.cpp'
--- a/libcore/asobj/flash/events/ActivityEvent_as.cpp   2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/ActivityEvent_as.cpp   2009-07-15 09:33:59 
+0000
@@ -115,7 +115,7 @@
 }
 
 as_value
-activityevent_ctor(const fn_call& fn)
+activityevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ActivityEvent_as;
 

=== modified file 'libcore/asobj/flash/events/AsyncErrorEvent_as.cpp'
--- a/libcore/asobj/flash/events/AsyncErrorEvent_as.cpp 2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/AsyncErrorEvent_as.cpp 2009-07-15 09:21:26 
+0000
@@ -79,7 +79,7 @@
 }
 
 void
-attachAsyncErrorEventStaticInterface(as_object& o)
+attachAsyncErrorEventStaticInterface(as_object& /*o*/)
 {
 }
 

=== modified file 'libcore/asobj/flash/events/ContextMenuEvent_as.cpp'
--- a/libcore/asobj/flash/events/ContextMenuEvent_as.cpp        2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/events/ContextMenuEvent_as.cpp        2009-07-15 
09:33:59 +0000
@@ -128,7 +128,7 @@
 }
 
 as_value
-contextmenuevent_ctor(const fn_call& fn)
+contextmenuevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ContextMenuEvent_as;
 

=== modified file 'libcore/asobj/flash/events/DataEvent_as.cpp'
--- a/libcore/asobj/flash/events/DataEvent_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/DataEvent_as.cpp       2009-07-15 09:33:59 
+0000
@@ -128,7 +128,7 @@
 }
 
 as_value
-dataevent_ctor(const fn_call& fn)
+dataevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new DataEvent_as;
 

=== modified file 'libcore/asobj/flash/events/ErrorEvent_as.cpp'
--- a/libcore/asobj/flash/events/ErrorEvent_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/ErrorEvent_as.cpp      2009-07-15 09:33:59 
+0000
@@ -115,7 +115,7 @@
 }
 
 as_value
-errorevent_ctor(const fn_call& fn)
+errorevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ErrorEvent_as;
 

=== modified file 'libcore/asobj/flash/events/EventDispatcher_as.cpp'
--- a/libcore/asobj/flash/events/EventDispatcher_as.cpp 2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/EventDispatcher_as.cpp 2009-07-15 09:33:59 
+0000
@@ -164,7 +164,7 @@
 }
 
 as_value
-eventdispatcher_ctor(const fn_call& fn)
+eventdispatcher_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new EventDispatcher_as;
 

=== modified file 'libcore/asobj/flash/events/EventPhase_as.cpp'
--- a/libcore/asobj/flash/events/EventPhase_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/EventPhase_as.cpp      2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachEventPhaseInterface(as_object& o)
+attachEventPhaseInterface(as_object& /*o*/)
 {
 }
 
 void
-attachEventPhaseStaticInterface(as_object& o)
+attachEventPhaseStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-eventphase_ctor(const fn_call& fn)
+eventphase_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new EventPhase_as;
 

=== modified file 'libcore/asobj/flash/events/Event_as.cpp'
--- a/libcore/asobj/flash/events/Event_as.cpp   2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/events/Event_as.cpp   2009-07-15 09:33:59 +0000
@@ -488,7 +488,7 @@
 }
 
 as_value
-event_ctor(const fn_call& fn)
+event_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Event_as;
 

=== modified file 'libcore/asobj/flash/events/FocusEvent_as.cpp'
--- a/libcore/asobj/flash/events/FocusEvent_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/FocusEvent_as.cpp      2009-07-15 09:33:59 
+0000
@@ -151,7 +151,7 @@
 }
 
 as_value
-focusevent_ctor(const fn_call& fn)
+focusevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new FocusEvent_as;
 

=== modified file 'libcore/asobj/flash/events/FullScreenEvent_as.cpp'
--- a/libcore/asobj/flash/events/FullScreenEvent_as.cpp 2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/FullScreenEvent_as.cpp 2009-07-15 09:33:59 
+0000
@@ -115,7 +115,7 @@
 }
 
 as_value
-fullscreenevent_ctor(const fn_call& fn)
+fullscreenevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new FullScreenEvent_as;
 

=== modified file 'libcore/asobj/flash/events/HTTPStatusEvent_as.cpp'
--- a/libcore/asobj/flash/events/HTTPStatusEvent_as.cpp 2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/HTTPStatusEvent_as.cpp 2009-07-15 09:33:59 
+0000
@@ -115,7 +115,7 @@
 }
 
 as_value
-httpstatusevent_ctor(const fn_call& fn)
+httpstatusevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new HTTPStatusEvent_as;
 

=== modified file 'libcore/asobj/flash/events/IEventDispatcher_as.cpp'
--- a/libcore/asobj/flash/events/IEventDispatcher_as.cpp        2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/events/IEventDispatcher_as.cpp        2009-07-15 
09:33:59 +0000
@@ -83,7 +83,7 @@
 }
 
 void
-attachIEventDispatcherStaticInterface(as_object& o)
+attachIEventDispatcherStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -139,7 +139,7 @@
 }
 
 as_value
-ieventdispatcher_ctor(const fn_call& fn)
+ieventdispatcher_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IEventDispatcher_as;
 

=== modified file 'libcore/asobj/flash/events/IMEEvent_as.cpp'
--- a/libcore/asobj/flash/events/IMEEvent_as.cpp        2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/IMEEvent_as.cpp        2009-07-15 09:33:59 
+0000
@@ -116,7 +116,7 @@
 }
 
 as_value
-imeevent_ctor(const fn_call& fn)
+imeevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IMEEvent_as;
 

=== modified file 'libcore/asobj/flash/events/IOErrorEvent_as.cpp'
--- a/libcore/asobj/flash/events/IOErrorEvent_as.cpp    2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/IOErrorEvent_as.cpp    2009-07-15 09:33:59 
+0000
@@ -115,7 +115,7 @@
 }
 
 as_value
-ioerrorevent_ctor(const fn_call& fn)
+ioerrorevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IOErrorEvent_as;
 

=== modified file 'libcore/asobj/flash/events/KeyboardEvent_as.cpp'
--- a/libcore/asobj/flash/events/KeyboardEvent_as.cpp   2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/KeyboardEvent_as.cpp   2009-07-15 09:33:59 
+0000
@@ -83,7 +83,7 @@
 }
 
 void
-attachKeyboardEventStaticInterface(as_object& o)
+attachKeyboardEventStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -139,7 +139,7 @@
 }
 
 as_value
-keyboardevent_ctor(const fn_call& fn)
+keyboardevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new KeyboardEvent_as;
 

=== modified file 'libcore/asobj/flash/events/MouseEvent_as.cpp'
--- a/libcore/asobj/flash/events/MouseEvent_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/MouseEvent_as.cpp      2009-07-15 09:33:59 
+0000
@@ -99,7 +99,7 @@
 }
 
 void
-attachMouseEventStaticInterface(as_object& o)
+attachMouseEventStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -236,7 +236,7 @@
 }
 
 as_value
-mouseevent_ctor(const fn_call& fn)
+mouseevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new MouseEvent_as;
 

=== modified file 'libcore/asobj/flash/events/NetStatusEvent_as.cpp'
--- a/libcore/asobj/flash/events/NetStatusEvent_as.cpp  2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/NetStatusEvent_as.cpp  2009-07-15 09:33:59 
+0000
@@ -79,7 +79,7 @@
 }
 
 void
-attachNetStatusEventStaticInterface(as_object& o)
+attachNetStatusEventStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -115,7 +115,7 @@
 }
 
 as_value
-netstatusevent_ctor(const fn_call& fn)
+netstatusevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new NetStatusEvent_as;
 

=== modified file 'libcore/asobj/flash/events/ProgressEvent_as.cpp'
--- a/libcore/asobj/flash/events/ProgressEvent_as.cpp   2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/ProgressEvent_as.cpp   2009-07-15 09:33:59 
+0000
@@ -128,7 +128,7 @@
 }
 
 as_value
-progressevent_ctor(const fn_call& fn)
+progressevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ProgressEvent_as;
 

=== modified file 'libcore/asobj/flash/events/SecurityErrorEvent_as.cpp'
--- a/libcore/asobj/flash/events/SecurityErrorEvent_as.cpp      2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/events/SecurityErrorEvent_as.cpp      2009-07-15 
09:33:59 +0000
@@ -79,7 +79,7 @@
 }
 
 void
-attachSecurityErrorEventStaticInterface(as_object& o)
+attachSecurityErrorEventStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -115,7 +115,7 @@
 }
 
 as_value
-securityerrorevent_ctor(const fn_call& fn)
+securityerrorevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new SecurityErrorEvent_as;
 

=== modified file 'libcore/asobj/flash/events/StatusEvent_as.cpp'
--- a/libcore/asobj/flash/events/StatusEvent_as.cpp     2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/StatusEvent_as.cpp     2009-07-15 09:33:59 
+0000
@@ -79,7 +79,7 @@
 }
 
 void
-attachStatusEventStaticInterface(as_object& o)
+attachStatusEventStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -115,7 +115,7 @@
 }
 
 as_value
-statusevent_ctor(const fn_call& fn)
+statusevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new StatusEvent_as;
 

=== modified file 'libcore/asobj/flash/events/SyncEvent_as.cpp'
--- a/libcore/asobj/flash/events/SyncEvent_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/SyncEvent_as.cpp       2009-07-15 09:33:59 
+0000
@@ -79,7 +79,7 @@
 }
 
 void
-attachSyncEventStaticInterface(as_object& o)
+attachSyncEventStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -115,7 +115,7 @@
 }
 
 as_value
-syncevent_ctor(const fn_call& fn)
+syncevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new SyncEvent_as;
 

=== modified file 'libcore/asobj/flash/events/TextEvent_as.cpp'
--- a/libcore/asobj/flash/events/TextEvent_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/TextEvent_as.cpp       2009-07-15 09:33:59 
+0000
@@ -128,7 +128,7 @@
 }
 
 as_value
-textevent_ctor(const fn_call& fn)
+textevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new TextEvent_as;
 

=== modified file 'libcore/asobj/flash/events/TimerEvent_as.cpp'
--- a/libcore/asobj/flash/events/TimerEvent_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/events/TimerEvent_as.cpp      2009-07-15 09:33:59 
+0000
@@ -83,7 +83,7 @@
 }
 
 void
-attachTimerEventStaticInterface(as_object& o)
+attachTimerEventStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -139,7 +139,7 @@
 }
 
 as_value
-timerevent_ctor(const fn_call& fn)
+timerevent_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new TimerEvent_as;
 

=== modified file 'libcore/asobj/flash/filters/BitmapFilter_as.cpp'
--- a/libcore/asobj/flash/filters/BitmapFilter_as.cpp   2009-07-14 12:25:24 
+0000
+++ b/libcore/asobj/flash/filters/BitmapFilter_as.cpp   2009-07-15 08:23:37 
+0000
@@ -80,13 +80,8 @@
 as_value
 getBitmapFilterConstructor(const fn_call& fn)
 {
-    static builtin_function* cl;
-    if (!cl) {
-        cl = new builtin_function(&bitmapfilter_ctor,
-                getBitmapFilterInterface());
-        getVM(fn).addStatic(cl);
-    }
-    return cl;
+    Global_as* gl = getGlobal(fn);
+    return gl->createClass(&bitmapfilter_ctor, getBitmapFilterInterface());
 }
 
 as_value

=== modified file 'libcore/asobj/flash/filters/ConvolutionFilter_as.cpp'
--- a/libcore/asobj/flash/filters/ConvolutionFilter_as.cpp      2009-07-14 
06:01:56 +0000
+++ b/libcore/asobj/flash/filters/ConvolutionFilter_as.cpp      2009-07-15 
08:23:37 +0000
@@ -19,6 +19,7 @@
 #include "as_object.h"
 #include "ConvolutionFilter.h"
 #include "VM.h"
+#include "Global_as.h"
 #include "builtin_function.h"
 #include "Object.h"
 #include "BitmapFilter_as.h"
@@ -107,13 +108,9 @@
 as_value
 getConvolutionFilterConstructor(const fn_call& fn)
 {
-    static builtin_function* cl;
-    if (!cl) {
-        cl = new builtin_function(&convolutionfilter_ctor,
-                getConvolutionFilterInterface());
-        getVM(fn).addStatic(cl);
-    }
-    return cl;
+    Global_as* gl = getGlobal(fn);
+    return gl->createClass(&convolutionfilter_ctor,
+            getConvolutionFilterInterface());
 }
 
 as_value

=== modified file 'libcore/asobj/flash/filters/DisplacementMapFilterMode_as.cpp'
--- a/libcore/asobj/flash/filters/DisplacementMapFilterMode_as.cpp      
2009-07-14 11:43:51 +0000
+++ b/libcore/asobj/flash/filters/DisplacementMapFilterMode_as.cpp      
2009-07-15 09:33:59 +0000
@@ -51,7 +51,7 @@
 namespace {
 
 void
-attachDisplacementMapFilterModeStaticInterface(as_object& o)
+attachDisplacementMapFilterModeStaticInterface(as_object& /*o*/)
 {
 
 }

=== modified file 'libcore/asobj/flash/flash_pkg.cpp'
--- a/libcore/asobj/flash/flash_pkg.cpp 2009-07-14 06:01:56 +0000
+++ b/libcore/asobj/flash/flash_pkg.cpp 2009-07-15 09:33:59 +0000
@@ -31,25 +31,25 @@
 class as_object;
 
 static as_value
-get_flash_package(const fn_call& fn)
+get_flash_package(const fn_call& /*fn*/)
 {
     as_object *pkg = new as_object(getObjectInterface());
 
-       int i = 0;
+    int i = 0;
     while (as2classes[i]) {
         as2classes[i](*pkg);
         ++i;
     }
 
-       return pkg;
+    return pkg;
 }
 
 void
 flash_package_init(as_object& where)
 {
-       string_table& st = getStringTable(where);
-       where.init_destructive_property(st.find("flash"), get_flash_package,
-               as_prop_flags::dontEnum | as_prop_flags::onlySWF8Up);
+    string_table& st = getStringTable(where);
+    where.init_destructive_property(st.find("flash"), get_flash_package,
+        as_prop_flags::dontEnum | as_prop_flags::onlySWF8Up);
 }
 
 }

=== modified file 'libcore/asobj/flash/geom/ColorTransform_as.cpp'
--- a/libcore/asobj/flash/geom/ColorTransform_as.cpp    2009-07-14 09:26:21 
+0000
+++ b/libcore/asobj/flash/geom/ColorTransform_as.cpp    2009-07-15 07:57:08 
+0000
@@ -354,24 +354,12 @@
 }
 
 
-as_function* getFlashGeomColorTransformConstructor()
-{
-    static builtin_function* cl = NULL;
-    if ( ! cl )
-    {
-        cl=new builtin_function(&ColorTransform_ctor, 
getColorTransformInterface());
-        VM::get().addStatic(cl);
-    }
-    return cl;
-}
-
-
 static as_value
-get_flash_geom_color_transform_constructor(const fn_call& /*fn*/)
+get_flash_geom_color_transform_constructor(const fn_call& fn)
 {
     log_debug("Loading flash.geom.ColorTransform class");
-
-    return getFlashGeomColorTransformConstructor();
+    Global_as* gl = getGlobal(fn);
+    return gl->createClass(&ColorTransform_ctor, getColorTransformInterface());
 }
 
 

=== modified file 'libcore/asobj/flash/geom/ColorTransform_as.h'
--- a/libcore/asobj/flash/geom/ColorTransform_as.h      2009-05-25 18:28:53 
+0000
+++ b/libcore/asobj/flash/geom/ColorTransform_as.h      2009-07-15 06:52:58 
+0000
@@ -81,10 +81,6 @@
 /// Initialize the global ColorTransform class
 void colortransform_class_init(as_object& global);
 
-/// Return a ColorTransform instance (in case the core lib needs it)
-//std::auto_ptr<as_object> init_ColorTransform_instance();
-
 } // end of gnash namespace
 
-// __GNASH_ASOBJ_COLORTRANSFORM_H__
 #endif

=== modified file 'libcore/asobj/flash/geom/Matrix_as.cpp'
--- a/libcore/asobj/flash/geom/Matrix_as.cpp    2009-07-14 09:26:21 +0000
+++ b/libcore/asobj/flash/geom/Matrix_as.cpp    2009-07-15 08:23:37 +0000
@@ -143,18 +143,6 @@
 };
 
 
-as_function* getFlashGeomMatrixConstructor()
-{
-    static builtin_function* cl = NULL;
-    if ( ! cl )
-    {
-        cl=new builtin_function(&Matrix_ctor, getMatrixInterface());
-        VM::get().addStatic(cl);
-    }
-    return cl;
-}
-
-
 /// Return an exact copy of the matrix.
 static as_value
 Matrix_clone(const fn_call& fn)
@@ -214,7 +202,7 @@
     }
 
     // The object to concatenate doesn't have to be a matrix.    
-    as_object* obj = arg.to_object().get();
+    as_object* obj = arg.to_object(*getGlobal(fn)).get();
     assert(obj);
 
     MatrixType concatMatrix;
@@ -416,7 +404,7 @@
 
     // It doesn't have to be a point. If it has x and y
     // properties, they will be used.    
-    as_object* obj = arg.to_object().get();
+    as_object* obj = arg.to_object(*getGlobal(fn)).get();
     assert(obj);
 
     const PointType& point = transformPoint(obj, ptr.get());
@@ -706,15 +694,15 @@
         return as_value();
     }
     
-    as_object* obj = arg.to_object().get();
+    as_object* obj = arg.to_object(*getGlobal(fn)).get();
     assert(obj);
-    if ( ! obj->instanceOf(getFlashGeomPointConstructor()) )
-    {
+    if (!obj->instanceOf(getFlashGeomPointConstructor(fn))) {
         /// Isn't a point.
         IF_VERBOSE_ASCODING_ERRORS(
             std::ostringstream ss;
             fn.dump_args(ss);
-            log_aserror("Matrix.transformPoint(%s): object must be a Point", 
ss.str());
+            log_aserror("Matrix.transformPoint(%s): object must be a Point",
+                ss.str());
         );
         return as_value();
     }
@@ -905,11 +893,11 @@
 
 
 static as_value
-get_flash_geom_matrix_constructor(const fn_call& /*fn*/)
+get_flash_geom_matrix_constructor(const fn_call& fn)
 {
     log_debug("Loading flash.geom.Matrix class");
-
-    return getFlashGeomMatrixConstructor();
+    Global_as* gl = getGlobal(fn);
+    return gl->createClass(&Matrix_ctor, getMatrixInterface());
 }
 
 // extern 

=== modified file 'libcore/asobj/flash/geom/Matrix_as.h'
--- a/libcore/asobj/flash/geom/Matrix_as.h      2009-05-25 18:28:53 +0000
+++ b/libcore/asobj/flash/geom/Matrix_as.h      2009-07-15 06:49:54 +0000
@@ -24,23 +24,13 @@
 #include "gnashconfig.h"
 #endif
 
-//#include <memory> // for auto_ptr
-
 namespace gnash {
 
 class as_object;
-class as_function;
 
 /// Initialize the global Matrix class
 void matrix_class_init(as_object& global);
 
-/// Return a Matrix instance (in case the core lib needs it)
-//std::auto_ptr<as_object> init_Matrix_instance();
-
-// This will probably be needed by other geom classes.
-as_function* getFlashGeomMatrixConstructor();
-
 } // end of gnash namespace
 
-// __GNASH_ASOBJ_MATRIX_H__
 #endif

=== modified file 'libcore/asobj/flash/geom/Point_as.cpp'
--- a/libcore/asobj/flash/geom/Point_as.cpp     2009-07-14 09:26:21 +0000
+++ b/libcore/asobj/flash/geom/Point_as.cpp     2009-07-15 08:23:37 +0000
@@ -131,7 +131,7 @@
                }
                );
                const as_value& arg1 = fn.arg(0);
-               as_object* o = arg1.to_object().get();
+               as_object* o = arg1.to_object(*getGlobal(fn)).get();
                if ( ! o )
                {
                        IF_VERBOSE_ASCODING_ERRORS(
@@ -204,17 +204,19 @@
        {
                IF_VERBOSE_ASCODING_ERRORS(
                std::stringstream ss; fn.dump_args(ss);
-               log_aserror("Point.equals(%s): %s", ss.str(), _("First arg must 
be an object"));
+               log_aserror("Point.equals(%s): %s", ss.str(),
+            _("First arg must be an object"));
                );
                return as_value(false);
        }
-       as_object* o = arg1.to_object().get();
+       as_object* o = arg1.to_object(*getGlobal(fn)).get();
        assert(o);
-       if ( ! o->instanceOf(getFlashGeomPointConstructor()) )
+       if ( ! o->instanceOf(getFlashGeomPointConstructor(fn)) )
        {
                IF_VERBOSE_ASCODING_ERRORS(
                std::stringstream ss; fn.dump_args(ss);
-               log_aserror("Point.equals(%s): %s %s", ss.str(), _("First arg 
must be an instance of"), "flash.geom.Point");
+               log_aserror("Point.equals(%s): %s %s", ss.str(),
+            _("First arg must be an instance of"), "flash.geom.Point");
                );
                return as_value(false);
        }
@@ -336,7 +338,7 @@
                }
                );
                const as_value& arg1 = fn.arg(0);
-               as_object* o = arg1.to_object().get();
+               as_object* o = arg1.to_object(*getGlobal(fn)).get();
                if ( ! o )
                {
                        IF_VERBOSE_ASCODING_ERRORS(
@@ -448,9 +450,9 @@
                );
                return as_value();
        }
-       as_object* o1 = arg1.to_object().get();
+       as_object* o1 = arg1.to_object(*getGlobal(fn)).get();
        assert(o1);
-       if ( ! o1->instanceOf(getFlashGeomPointConstructor()) )
+       if ( ! o1->instanceOf(getFlashGeomPointConstructor(fn)) )
        {
                IF_VERBOSE_ASCODING_ERRORS(
                std::stringstream ss; fn.dump_args(ss);
@@ -460,7 +462,7 @@
        }
 
        const as_value& arg2 = fn.arg(1);
-       as_object* o2 = arg2.to_object().get();
+       as_object* o2 = arg2.to_object(*getGlobal(fn)).get();
        assert(o2);
        // it seems there's no need to check arg2 (see 
actionscript.all/Point.as)
 
@@ -520,7 +522,7 @@
                );
 
                const as_value& p0val = fn.arg(0);
-               as_object* p0 = p0val.to_object().get();
+               as_object* p0 = p0val.to_object(*getGlobal(fn)).get();
                if ( ! p0 )
                {
                        IF_VERBOSE_ASCODING_ERRORS(
@@ -535,7 +537,7 @@
                }
 
                const as_value& p1val = fn.arg(1);
-               as_object* p1 = p1val.to_object().get();
+               as_object* p1 = p1val.to_object(*getGlobal(fn)).get();
                if ( ! p1 )
                {
                        IF_VERBOSE_ASCODING_ERRORS(
@@ -657,23 +659,21 @@
 }
 
 // extern 
-as_function* getFlashGeomPointConstructor()
+as_function*
+getFlashGeomPointConstructor(const fn_call& fn)
 {
-       static builtin_function* cl=NULL;
-       if ( ! cl )
-       {
-               cl=new builtin_function(&Point_ctor, getPointInterface());
-               VM::get().addStatic(cl);
-               attachPointStaticProperties(*cl);
-       }
-       return cl;
+    as_value point(fn.env().find_object("flash.geom.Point"));
+    return point.to_as_function();
 }
 
-static as_value get_flash_geom_point_constructor(const fn_call& /*fn*/)
+static
+as_value get_flash_geom_point_constructor(const fn_call& fn)
 {
        log_debug("Loading flash.geom.Point class");
-
-       return getFlashGeomPointConstructor();
+    Global_as* gl = getGlobal(fn);
+    as_object* cl = gl->createClass(&Point_ctor, getPointInterface());
+    attachPointStaticProperties(*cl);
+    return cl;
 }
 
 boost::intrusive_ptr<as_object> init_Point_instance()

=== modified file 'libcore/asobj/flash/geom/Point_as.h'
--- a/libcore/asobj/flash/geom/Point_as.h       2009-05-25 18:28:53 +0000
+++ b/libcore/asobj/flash/geom/Point_as.h       2009-07-15 08:23:37 +0000
@@ -30,6 +30,7 @@
 
 class as_function;
 class as_object;
+class fn_call;
 
 /// Initialize the global Point class
 void point_class_init(as_object& global);
@@ -38,7 +39,7 @@
 boost::intrusive_ptr<as_object> init_Point_instance();
 
 /// Return the Point constructor, for use by Rectangle 
-as_function* getFlashGeomPointConstructor();
+as_function* getFlashGeomPointConstructor(const fn_call& fn);
 
 } // end of gnash namespace
 

=== modified file 'libcore/asobj/flash/geom/Rectangle_as.cpp'
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp 2009-07-14 09:26:21 +0000
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp 2009-07-15 07:57:08 +0000
@@ -22,7 +22,6 @@
 #endif
 
 #include "Rectangle_as.h"
-#include "Point_as.h"
 #include "as_object.h" // for inheritance
 #include "log.h"
 #include "fn_call.h"
@@ -421,10 +420,8 @@
        boost::intrusive_ptr<Rectangle_as> ptr = 
         ensureType<Rectangle_as>(fn.this_ptr);
 
-       as_value ret;
+       if (!fn.nargs) {
 
-       if ( ! fn.nargs ) // getter
-       {
                as_value x,y,w,h;
                ptr->get_member(NSV::PROP_X, &x);
                ptr->get_member(NSV::PROP_Y, &y);
@@ -434,23 +431,29 @@
                as_value right = x.newAdd(w);
                as_value bottom = y.newAdd(h);
 
-               as_function* pointCtor = getFlashGeomPointConstructor();
+        as_value point(fn.env().find_object("flash.geom.Point"));
+
+        boost::intrusive_ptr<as_function> pointCtor = point.to_as_function();
+
+        if (!pointCtor) {
+            log_error("Failed to construct flash.geom.Point!");
+            return as_value();
+        }
 
                std::auto_ptr<std::vector<as_value> > args(new 
std::vector<as_value>);
                args->push_back(right);
                args->push_back(bottom);
 
-               ret = pointCtor->constructInstance(fn.env(), args);
-       }
-       else // setter
-       {
-               IF_VERBOSE_ASCODING_ERRORS(
-               log_aserror(_("Attempt to set read-only property %s"),
-            "Rectangle.bottomRight");
-               );
-       }
-
-       return ret;
+               as_value ret = pointCtor->constructInstance(fn.env(), args);
+        return ret;
+       }
+
+    IF_VERBOSE_ASCODING_ERRORS(
+    log_aserror(_("Attempt to set read-only property %s"),
+        "Rectangle.bottomRight");
+    );
+    return as_value();
+
 }
 
 static as_value
@@ -522,7 +525,14 @@
                ptr->get_member(NSV::PROP_WIDTH, &w);
                ptr->get_member(NSV::PROP_HEIGHT, &h);
 
-               as_function* pointCtor = getFlashGeomPointConstructor();
+        as_value point(fn.env().find_object("flash.geom.Point"));
+
+        boost::intrusive_ptr<as_function> pointCtor = point.to_as_function();
+
+        if (!pointCtor) {
+            log_error("Failed to construct flash.geom.Point!");
+            return as_value();
+        }
 
                std::auto_ptr<std::vector<as_value> > args(new 
std::vector<as_value>);
                args->push_back(w);
@@ -582,7 +592,14 @@
                ptr->get_member(NSV::PROP_X, &x);
                ptr->get_member(NSV::PROP_Y, &y);
 
-               as_function* pointCtor = getFlashGeomPointConstructor();
+        as_value point(fn.env().find_object("flash.geom.Point"));
+
+        boost::intrusive_ptr<as_function> pointCtor = point.to_as_function();
+
+        if (!pointCtor) {
+            log_error("Failed to construct flash.geom.Point!");
+            return as_value();
+        }
 
                std::auto_ptr<std::vector<as_value> > args(new 
std::vector<as_value>);
                args->push_back(x);
@@ -646,22 +663,18 @@
        return as_value(obj.get()); // will keep alive
 }
 
-static as_value get_flash_geom_rectangle_constructor(const fn_call& /*fn*/)
+static as_value
+get_flash_geom_rectangle_constructor(const fn_call& fn)
 {
        log_debug("Loading flash.geom.Rectangle class");
 
-       builtin_function* cl =
-               new builtin_function(&Rectangle_ctor, getRectangleInterface());
-       return cl;
-}
-
-boost::intrusive_ptr<as_object> init_Rectangle_instance()
-{
-    return boost::intrusive_ptr<as_object>(new Rectangle_as);
+    Global_as* gl = getGlobal(fn);
+    return gl->createClass(&Rectangle_ctor, getRectangleInterface());
 }
 
 // extern 
-void rectangle_class_init(as_object& where)
+void
+rectangle_class_init(as_object& where)
 {
        // Register _global.Rectangle
        string_table& st = getStringTable(where);

=== modified file 'libcore/asobj/flash/geom/Transform_as.cpp'
--- a/libcore/asobj/flash/geom/Transform_as.cpp 2009-07-14 09:11:14 +0000
+++ b/libcore/asobj/flash/geom/Transform_as.cpp 2009-07-15 07:57:08 +0000
@@ -40,62 +40,20 @@
 
 namespace gnash {
 
-static as_value Transform_colorTransform_getset(const fn_call& fn);
-static as_value Transform_concatenatedColorTransform_getset(const fn_call& fn);
-static as_value Transform_concatenatedMatrix_getset(const fn_call& fn);
-static as_value Transform_matrix_getset(const fn_call& fn);
-static as_value Transform_pixelBounds_getset(const fn_call& fn);
-
-
-as_value Transform_ctor(const fn_call& fn);
-
-static void
-attachTransformInterface(as_object& o)
-{
-    Global_as* gl = getGlobal(o);
-    const int protectedFlags = as_prop_flags::isProtected;
-
-    o.init_property("matrix",
-            Transform_matrix_getset,
-            Transform_matrix_getset, protectedFlags);
-    o.init_property("concatenatedMatrix",
-            Transform_concatenatedMatrix_getset,
-            Transform_concatenatedMatrix_getset, protectedFlags);
-    o.init_property("colorTransform",
-            Transform_colorTransform_getset,
-            Transform_colorTransform_getset, protectedFlags);
-    o.init_property("concatenatedColorTransform",
-            Transform_concatenatedColorTransform_getset,
-            Transform_concatenatedColorTransform_getset, protectedFlags);
-    o.init_property("pixelBounds",
-            Transform_pixelBounds_getset,
-            Transform_pixelBounds_getset, protectedFlags);
-}
-
-static void
-attachTransformStaticProperties(as_object& /*o*/)
-{
-   
-}
-
-static as_object*
-getTransformInterface()
-{
-       static boost::intrusive_ptr<as_object> o;
-
-       if ( ! o )
-       {
-               // TODO: check if this class should inherit from Object
-               //       or from a different class
-               o = new as_object(getObjectInterface());
-               VM::get().addStatic(o.get());
-
-               attachTransformInterface(*o);
-
-       }
-
-       return o.get();
-}
+namespace {
+
+    as_value Transform_colorTransform(const fn_call& fn);
+    as_value Transform_concatenatedColorTransform(const fn_call& fn);
+    as_value Transform_concatenatedMatrix(const fn_call& fn);
+    as_value Transform_matrix(const fn_call& fn);
+    as_value Transform_pixelBounds(const fn_call& fn);
+    as_value Transform_ctor(const fn_call& fn);
+    void attachTransformInterface(as_object& o);
+    as_object* getTransformInterface();
+    as_value get_flash_geom_transform_constructor(const fn_call& fn);
+}
+
+
 
 class Transform_as: public as_object
 {
@@ -142,8 +100,25 @@
     return static_cast<boost::int16_t>(d);
 }
 
-static as_value
-Transform_colorTransform_getset(const fn_call& fn)
+// extern 
+void
+transform_class_init(as_object& where)
+{
+
+       // Register _global.Transform
+    string_table& st = getStringTable(where);
+    
+    // TODO: this may not be correct, but it should be enumerable.
+    const int flags = 0;
+    where.init_destructive_property(st.find("Transform"), 
+                   get_flash_geom_transform_constructor, flags);
+
+}
+
+namespace {
+
+as_value
+Transform_colorTransform(const fn_call& fn)
 {
 
     const double factor = 256.0;
@@ -195,7 +170,7 @@
         );
     }
 
-    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object(*getGlobal(fn));
     if (!obj)
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -209,7 +184,8 @@
     
     // TODO: check whether this is necessary (probable), 
     // or whether it can be any object.
-    boost::intrusive_ptr<ColorTransform_as> transform = 
dynamic_cast<ColorTransform_as*>(obj.get());
+    boost::intrusive_ptr<ColorTransform_as> transform =
+        dynamic_cast<ColorTransform_as*>(obj.get());
     if (!transform)
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -236,28 +212,28 @@
     return as_value();
 }
 
-static as_value
-Transform_concatenatedColorTransform_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<Transform_as> ptr = 
-        ensureType<Transform_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-Transform_concatenatedMatrix_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<Transform_as> ptr = 
-        ensureType<Transform_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
-
-static as_value
-Transform_matrix_getset(const fn_call& fn)
+as_value
+Transform_concatenatedColorTransform(const fn_call& fn)
+{
+       boost::intrusive_ptr<Transform_as> ptr = 
+        ensureType<Transform_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+Transform_concatenatedMatrix(const fn_call& fn)
+{
+       boost::intrusive_ptr<Transform_as> ptr = 
+        ensureType<Transform_as>(fn.this_ptr);
+       UNUSED(ptr);
+       LOG_ONCE( log_unimpl (__FUNCTION__) );
+       return as_value();
+}
+
+as_value
+Transform_matrix(const fn_call& fn)
 {
 
     const double factor = 65536.0;
@@ -312,7 +288,7 @@
     }
 
 
-    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+    boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object(*getGlobal(fn));
     if (!obj)
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -348,8 +324,8 @@
 
 }
 
-static as_value
-Transform_pixelBounds_getset(const fn_call& fn)
+as_value
+Transform_pixelBounds(const fn_call& fn)
 {
        boost::intrusive_ptr<Transform_as> ptr = 
         ensureType<Transform_as>(fn.this_ptr);
@@ -365,26 +341,28 @@
 Transform_ctor(const fn_call& fn)
 {
 
-    if (!fn.nargs)
-    {
+    if (!fn.nargs) {
+
         IF_VERBOSE_ASCODING_ERRORS(
             std::ostringstream ss;
             fn.dump_args(ss);
-            log_aserror("flash.geom.Transform(%s): needs one argument", 
ss.str());
+            log_aserror("flash.geom.Transform(%s): needs one argument",
+                ss.str());
         );
         return as_value();
     }
 
     // TODO: what about more than one argument? 
-       if (fn.nargs > 1)
-       {
+       if (fn.nargs > 1) {
                std::stringstream ss;
                fn.dump_args(ss);
-               LOG_ONCE( log_unimpl("Transform(%s): %s", ss.str(), 
_("arguments discarded")) );
+               LOG_ONCE(log_unimpl("Transform(%s): %s", ss.str(),
+                    _("arguments discarded")) );
        }
 
     // TODO: does this have to be a MovieClip or can it be any DisplayObject?
-    boost::intrusive_ptr<MovieClip> mc = 
ensureType<MovieClip>(fn.arg(0).to_object());
+    boost::intrusive_ptr<MovieClip> mc =
+        ensureType<MovieClip>(fn.arg(0).to_object(*getGlobal(fn)));
 
        boost::intrusive_ptr<as_object> obj = new Transform_as(*mc);
 
@@ -393,43 +371,51 @@
        return as_value(obj.get()); // will keep alive
 }
 
-as_function* getFlashGeomTransformConstructor()
-{
-    static builtin_function* cl = NULL;
-    if ( ! cl )
-    {
-        cl=new builtin_function(&Transform_ctor, getTransformInterface());
-        VM::get().addStatic(cl);
-        attachTransformStaticProperties(*cl);
-    }
-    return cl;
-}
-
-static as_value
-get_flash_geom_transform_constructor(const fn_call& /*fn*/)
+as_value
+get_flash_geom_transform_constructor(const fn_call& fn)
 {
     log_debug("Loading flash.geom.Transform class");
-
-    return getFlashGeomTransformConstructor();
-}
-
-// extern 
-void transform_class_init(as_object& where)
-{
-       // This is going to be the Transform "class"/"function"
-       // in the 'where' package
-       boost::intrusive_ptr<builtin_function> cl;
-       cl=new builtin_function(&Transform_ctor, getTransformInterface());
-       attachTransformStaticProperties(*cl);
-
-       // Register _global.Transform
-    string_table& st = getStringTable(where);
-    
-    // TODO: this may not be correct, but it should be enumerable.
-    const int flags = 0;
-    where.init_destructive_property(st.find("Transform"), 
-                   get_flash_geom_transform_constructor, flags);
-
-}
+    Global_as* gl = getGlobal(fn);
+    return gl->createClass(&Transform_ctor, getTransformInterface());
+}
+
+as_object*
+getTransformInterface()
+{
+       static boost::intrusive_ptr<as_object> o;
+
+       if (!o) {
+
+               // TODO: check if this class should inherit from Object
+               //       or from a different class
+               o = new as_object(getObjectInterface());
+               VM::get().addStatic(o.get());
+
+               attachTransformInterface(*o);
+
+       }
+
+       return o.get();
+}
+
+void
+attachTransformInterface(as_object& o)
+{
+    const int protectedFlags = as_prop_flags::isProtected;
+
+    o.init_property("matrix", Transform_matrix, Transform_matrix,
+            protectedFlags);
+    o.init_property("concatenatedMatrix", Transform_concatenatedMatrix,
+            Transform_concatenatedMatrix, protectedFlags);
+    o.init_property("colorTransform", Transform_colorTransform,
+            Transform_colorTransform, protectedFlags);
+    o.init_property("concatenatedColorTransform",
+            Transform_concatenatedColorTransform,
+            Transform_concatenatedColorTransform, protectedFlags);
+    o.init_property("pixelBounds", Transform_pixelBounds,
+            Transform_pixelBounds, protectedFlags);
+}
+
+} // anonymous namespace
 
 } // end of gnash namespace

=== modified file 'libcore/asobj/flash/geom/Transform_as.h'
--- a/libcore/asobj/flash/geom/Transform_as.h   2009-05-25 18:28:53 +0000
+++ b/libcore/asobj/flash/geom/Transform_as.h   2009-07-15 06:52:58 +0000
@@ -17,15 +17,13 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#ifndef __GNASH_ASOBJ_TRANSFORM_H__
-#define __GNASH_ASOBJ_TRANSFORM_H__
+#ifndef GNASH_ASOBJ_TRANSFORM_H
+#define GNASH_ASOBJ_TRANSFORM_H
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
 #endif
 
-//#include <memory> // for auto_ptr
-
 namespace gnash {
 
 class as_object;
@@ -33,10 +31,6 @@
 /// Initialize the global Transform class
 void transform_class_init(as_object& global);
 
-/// Return a Transform instance (in case the core lib needs it)
-//std::auto_ptr<as_object> init_Transform_instance();
-
 } // end of gnash namespace
 
-// __GNASH_ASOBJ_TRANSFORM_H__
 #endif

=== modified file 'libcore/asobj/flash/media/ID3Info_as.cpp'
--- a/libcore/asobj/flash/media/ID3Info_as.cpp  2009-07-14 12:25:24 +0000
+++ b/libcore/asobj/flash/media/ID3Info_as.cpp  2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachID3InfoInterface(as_object& o)
+attachID3InfoInterface(as_object& /*o*/)
 {
 }
 
 void
-attachID3InfoStaticInterface(as_object& o)
+attachID3InfoStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-id3info_ctor(const fn_call& fn)
+id3info_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ID3Info_as;
 

=== modified file 'libcore/asobj/flash/media/SoundChannel_as.cpp'
--- a/libcore/asobj/flash/media/SoundChannel_as.cpp     2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/media/SoundChannel_as.cpp     2009-07-15 09:33:59 
+0000
@@ -103,7 +103,7 @@
 }
 
 as_value
-soundchannel_ctor(const fn_call& fn)
+soundchannel_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new SoundChannel_as;
 

=== modified file 'libcore/asobj/flash/media/SoundLoaderContext_as.cpp'
--- a/libcore/asobj/flash/media/SoundLoaderContext_as.cpp       2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/media/SoundLoaderContext_as.cpp       2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachSoundLoaderContextInterface(as_object& o)
+attachSoundLoaderContextInterface(as_object& /*o*/)
 {
 }
 
 void
-attachSoundLoaderContextStaticInterface(as_object& o)
+attachSoundLoaderContextStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-soundloadercontext_ctor(const fn_call& fn)
+soundloadercontext_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new SoundLoaderContext_as;
 

=== modified file 'libcore/asobj/flash/media/SoundMixer_as.cpp'
--- a/libcore/asobj/flash/media/SoundMixer_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/media/SoundMixer_as.cpp       2009-07-15 09:33:59 
+0000
@@ -79,7 +79,7 @@
 }
 
 void
-attachSoundMixerStaticInterface(as_object& o)
+attachSoundMixerStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -115,7 +115,7 @@
 }
 
 as_value
-soundmixer_ctor(const fn_call& fn)
+soundmixer_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new SoundMixer_as;
 

=== modified file 'libcore/asobj/flash/media/SoundTransform_as.cpp'
--- a/libcore/asobj/flash/media/SoundTransform_as.cpp   2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/media/SoundTransform_as.cpp   2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachSoundTransformInterface(as_object& o)
+attachSoundTransformInterface(as_object& /*o*/)
 {
 }
 
 void
-attachSoundTransformStaticInterface(as_object& o)
+attachSoundTransformStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-soundtransform_ctor(const fn_call& fn)
+soundtransform_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new SoundTransform_as;
 

=== modified file 'libcore/asobj/flash/media/Sound_as.cpp'
--- a/libcore/asobj/flash/media/Sound_as.cpp    2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/media/Sound_as.cpp    2009-07-14 15:39:12 +0000
@@ -808,7 +808,7 @@
         const as_value& arg0 = fn.arg(0);
         if ( ! arg0.is_null() && ! arg0.is_undefined() )
         {
-            as_object* obj = arg0.to_object().get();
+            as_object* obj = arg0.to_object(*getGlobal(fn)).get();
             DisplayObject* ch = obj ? obj->toDisplayObject() : 0;
             IF_VERBOSE_ASCODING_ERRORS(
             if ( ! ch )

=== modified file 'libcore/asobj/flash/media/Video_as.cpp'
--- a/libcore/asobj/flash/media/Video_as.cpp    2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/media/Video_as.cpp    2009-07-15 09:33:59 +0000
@@ -116,7 +116,7 @@
 }
 
 as_value
-video_ctor(const fn_call& fn)
+video_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Video_as;
 

=== modified file 'libcore/asobj/flash/media/media_as.cpp'
--- a/libcore/asobj/flash/media/media_as.cpp    2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/media/media_as.cpp    2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachmediaInterface(as_object& o)
+attachmediaInterface(as_object& /*o*/)
 {
 }
 
 void
-attachmediaStaticInterface(as_object& o)
+attachmediaStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-media_ctor(const fn_call& fn)
+media_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new media_as;
 

=== modified file 'libcore/asobj/flash/net/FileFilter_as.cpp'
--- a/libcore/asobj/flash/net/FileFilter_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/net/FileFilter_as.cpp 2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachFileFilterInterface(as_object& o)
+attachFileFilterInterface(as_object& /*o*/)
 {
 }
 
 void
-attachFileFilterStaticInterface(as_object& o)
+attachFileFilterStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-filefilter_ctor(const fn_call& fn)
+filefilter_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new FileFilter_as;
 

=== modified file 'libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp'
--- a/libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp     2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/net/IDynamicPropertyOutput_as.cpp     2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachIDynamicPropertyOutputInterface(as_object& o)
+attachIDynamicPropertyOutputInterface(as_object& /*o*/)
 {
 }
 
 void
-attachIDynamicPropertyOutputStaticInterface(as_object& o)
+attachIDynamicPropertyOutputStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-idynamicpropertyoutput_ctor(const fn_call& fn)
+idynamicpropertyoutput_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IDynamicPropertyOutput_as;
 

=== modified file 'libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp'
--- a/libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp     2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/net/IDynamicPropertyWriter_as.cpp     2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachIDynamicPropertyWriterInterface(as_object& o)
+attachIDynamicPropertyWriterInterface(as_object& /*o*/)
 {
 }
 
 void
-attachIDynamicPropertyWriterStaticInterface(as_object& o)
+attachIDynamicPropertyWriterStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-idynamicpropertywriter_ctor(const fn_call& fn)
+idynamicpropertywriter_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IDynamicPropertyWriter_as;
 

=== modified file 'libcore/asobj/flash/net/NetConnection_as.cpp'
--- a/libcore/asobj/flash/net/NetConnection_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/net/NetConnection_as.cpp      2009-07-15 09:33:59 
+0000
@@ -89,7 +89,7 @@
 }
 
 void
-attachNetConnectionStaticInterface(as_object& o)
+attachNetConnectionStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -175,7 +175,7 @@
 }
 
 as_value
-netconnection_ctor(const fn_call& fn)
+netconnection_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new NetConnection_as;
 

=== modified file 'libcore/asobj/flash/net/NetStream_as.cpp'
--- a/libcore/asobj/flash/net/NetStream_as.cpp  2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/net/NetStream_as.cpp  2009-07-15 09:33:59 +0000
@@ -332,7 +332,7 @@
 }
 
 as_value
-netstream_ctor(const fn_call& fn)
+netstream_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new NetStream_as;
 

=== modified file 'libcore/asobj/flash/net/ObjectEncoding_as.cpp'
--- a/libcore/asobj/flash/net/ObjectEncoding_as.cpp     2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/net/ObjectEncoding_as.cpp     2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachObjectEncodingInterface(as_object& o)
+attachObjectEncodingInterface(as_object& /*o*/)
 {
 }
 
 void
-attachObjectEncodingStaticInterface(as_object& o)
+attachObjectEncodingStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-objectencoding_ctor(const fn_call& fn)
+objectencoding_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ObjectEncoding_as;
 

=== modified file 'libcore/asobj/flash/net/Responder_as.cpp'
--- a/libcore/asobj/flash/net/Responder_as.cpp  2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/net/Responder_as.cpp  2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachResponderInterface(as_object& o)
+attachResponderInterface(as_object& /*o*/)
 {
 }
 
 void
-attachResponderStaticInterface(as_object& o)
+attachResponderStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-responder_ctor(const fn_call& fn)
+responder_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Responder_as;
 

=== modified file 'libcore/asobj/flash/net/SharedObject_as.cpp'
--- a/libcore/asobj/flash/net/SharedObject_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/net/SharedObject_as.cpp       2009-07-14 15:39:12 
+0000
@@ -1037,7 +1037,7 @@
     log_debug("Read %d AMF objects from %s", els.size(), filespec);
 
     as_value as = getMember(NSV::PROP_DATA);
-    boost::intrusive_ptr<as_object> ptr = as.to_object();
+    boost::intrusive_ptr<as_object> ptr = as.to_object(*getGlobal(fn));
     
     for (it = els.begin(), e = els.end(); it != e; it++) {
         boost::shared_ptr<amf::Element> el = *it;
@@ -1081,7 +1081,7 @@
             case Element::OBJECT_AMF0:
                 // TODO: implement!
                 log_unimpl("Reading OBJECT type from SharedObject");
-                //data.convert_to_object();
+                //data.convert_to_object(*getGlobal(fn));
                 //ptr->set_member(st.string_table::find(el->name), data);
                 return false;
                 break;

=== modified file 'libcore/asobj/flash/net/Socket_as.cpp'
--- a/libcore/asobj/flash/net/Socket_as.cpp     2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/net/Socket_as.cpp     2009-07-15 09:33:59 +0000
@@ -140,7 +140,7 @@
 }
 
 void
-attachSocketStaticInterface(as_object& o)
+attachSocketStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -476,7 +476,7 @@
 }
 
 as_value
-socket_ctor(const fn_call& fn)
+socket_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Socket_as;
 

=== modified file 'libcore/asobj/flash/net/URLLoader_as.cpp'
--- a/libcore/asobj/flash/net/URLLoader_as.cpp  2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/net/URLLoader_as.cpp  2009-07-15 09:33:59 +0000
@@ -91,10 +91,8 @@
 }
 
 void
-attachURLLoaderStaticInterface(as_object& o)
+attachURLLoaderStaticInterface(as_object& /*o*/)
 {
-    Global_as* gl = getGlobal(o);
-
 }
 
 as_object*
@@ -189,7 +187,7 @@
 }
 
 as_value
-urlloader_ctor(const fn_call& fn)
+urlloader_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new URLLoader_as;
 

=== modified file 'libcore/asobj/flash/net/URLRequestHeader_as.cpp'
--- a/libcore/asobj/flash/net/URLRequestHeader_as.cpp   2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/net/URLRequestHeader_as.cpp   2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachURLRequestHeaderInterface(as_object& o)
+attachURLRequestHeaderInterface(as_object& /*o*/)
 {
 }
 
 void
-attachURLRequestHeaderStaticInterface(as_object& o)
+attachURLRequestHeaderStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-urlrequestheader_ctor(const fn_call& fn)
+urlrequestheader_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new URLRequestHeader_as;
 

=== modified file 'libcore/asobj/flash/net/URLRequestMethod_as.cpp'
--- a/libcore/asobj/flash/net/URLRequestMethod_as.cpp   2009-07-14 11:18:42 
+0000
+++ b/libcore/asobj/flash/net/URLRequestMethod_as.cpp   2009-07-15 09:33:59 
+0000
@@ -51,7 +51,7 @@
 namespace {
 
 void
-attachURLRequestMethodStaticInterface(as_object& o)
+attachURLRequestMethodStaticInterface(as_object& /*o*/)
 {
     // TODO: add constants here.
 }

=== modified file 'libcore/asobj/flash/net/URLRequest_as.cpp'
--- a/libcore/asobj/flash/net/URLRequest_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/net/URLRequest_as.cpp 2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachURLRequestInterface(as_object& o)
+attachURLRequestInterface(as_object& /*o*/)
 {
 }
 
 void
-attachURLRequestStaticInterface(as_object& o)
+attachURLRequestStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-urlrequest_ctor(const fn_call& fn)
+urlrequest_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new URLRequest_as;
 

=== modified file 'libcore/asobj/flash/net/URLStream_as.cpp'
--- a/libcore/asobj/flash/net/URLStream_as.cpp  2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/net/URLStream_as.cpp  2009-07-15 09:33:59 +0000
@@ -344,7 +344,7 @@
 }
 
 as_value
-urlstream_ctor(const fn_call& fn)
+urlstream_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new URLStream_as;
 

=== modified file 'libcore/asobj/flash/net/URLVariables_as.cpp'
--- a/libcore/asobj/flash/net/URLVariables_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/net/URLVariables_as.cpp       2009-07-15 09:33:59 
+0000
@@ -103,7 +103,7 @@
 }
 
 as_value
-urlvariables_ctor(const fn_call& fn)
+urlvariables_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new URLVariables_as;
 

=== modified file 'libcore/asobj/flash/net/XMLSocket_as.cpp'
--- a/libcore/asobj/flash/net/XMLSocket_as.cpp  2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/net/XMLSocket_as.cpp  2009-07-15 08:23:37 +0000
@@ -580,8 +580,10 @@
 
     // all this crap to satisfy swfdec testsuite... (xml-socket-properties*)
     as_object* onDataIface = new as_object(getObjectInterface());
-    as_function* onDataFun = new builtin_function(xmlsocket_onData,
-            onDataIface);
+
+    // It's not really a class, but a constructor function with an object
+    // prototype, so looks in every way like an AS2 class.
+    as_object* onDataFun = gl->createClass(xmlsocket_onData, onDataIface);
     o.init_member("onData", onDataFun);
     onDataIface->init_member(NSV::PROP_CONSTRUCTOR, onDataFun);
 }

=== modified file 'libcore/asobj/flash/printing/PrintJobOptions_as.cpp'
--- a/libcore/asobj/flash/printing/PrintJobOptions_as.cpp       2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/printing/PrintJobOptions_as.cpp       2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachPrintJobOptionsInterface(as_object& o)
+attachPrintJobOptionsInterface(as_object& /*o*/)
 {
 }
 
 void
-attachPrintJobOptionsStaticInterface(as_object& o)
+attachPrintJobOptionsStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-printjoboptions_ctor(const fn_call& fn)
+printjoboptions_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new PrintJobOptions_as;
 

=== modified file 'libcore/asobj/flash/printing/PrintJob_as.cpp'
--- a/libcore/asobj/flash/printing/PrintJob_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/printing/PrintJob_as.cpp      2009-07-15 09:33:59 
+0000
@@ -79,7 +79,7 @@
 }
 
 void
-attachPrintJobStaticInterface(as_object& o)
+attachPrintJobStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -115,7 +115,7 @@
 }
 
 as_value
-printjob_ctor(const fn_call& fn)
+printjob_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new PrintJob_as;
 

=== modified file 'libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp'
--- a/libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp     2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/sampler/DeleteObjectSample_as.cpp     2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachDeleteObjectSampleInterface(as_object& o)
+attachDeleteObjectSampleInterface(as_object& /*o*/)
 {
 }
 
 void
-attachDeleteObjectSampleStaticInterface(as_object& o)
+attachDeleteObjectSampleStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-deleteobjectsample_ctor(const fn_call& fn)
+deleteobjectsample_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new DeleteObjectSample_as;
 

=== modified file 'libcore/asobj/flash/sampler/NewObjectSample_as.cpp'
--- a/libcore/asobj/flash/sampler/NewObjectSample_as.cpp        2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/sampler/NewObjectSample_as.cpp        2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachNewObjectSampleInterface(as_object& o)
+attachNewObjectSampleInterface(as_object& /*o*/)
 {
 }
 
 void
-attachNewObjectSampleStaticInterface(as_object& o)
+attachNewObjectSampleStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-newobjectsample_ctor(const fn_call& fn)
+newobjectsample_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new NewObjectSample_as;
 

=== modified file 'libcore/asobj/flash/sampler/Sample_as.cpp'
--- a/libcore/asobj/flash/sampler/Sample_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/sampler/Sample_as.cpp 2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachSampleInterface(as_object& o)
+attachSampleInterface(as_object& /*o*/)
 {
 }
 
 void
-attachSampleStaticInterface(as_object& o)
+attachSampleStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-sample_ctor(const fn_call& fn)
+sample_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Sample_as;
 

=== modified file 'libcore/asobj/flash/sampler/StackFrame_as.cpp'
--- a/libcore/asobj/flash/sampler/StackFrame_as.cpp     2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/sampler/StackFrame_as.cpp     2009-07-15 09:33:59 
+0000
@@ -128,7 +128,7 @@
 }
 
 as_value
-stackframe_ctor(const fn_call& fn)
+stackframe_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new StackFrame_as;
 

=== modified file 'libcore/asobj/flash/system/ApplicationDomain_as.cpp'
--- a/libcore/asobj/flash/system/ApplicationDomain_as.cpp       2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/system/ApplicationDomain_as.cpp       2009-07-15 
09:33:59 +0000
@@ -103,7 +103,7 @@
 }
 
 as_value
-applicationdomain_ctor(const fn_call& fn)
+applicationdomain_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ApplicationDomain_as;
 

=== modified file 'libcore/asobj/flash/system/Capabilities_as.cpp'
--- a/libcore/asobj/flash/system/Capabilities_as.cpp    2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/system/Capabilities_as.cpp    2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachCapabilitiesInterface(as_object& o)
+attachCapabilitiesInterface(as_object& /*o*/)
 {
 }
 
 void
-attachCapabilitiesStaticInterface(as_object& o)
+attachCapabilitiesStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-capabilities_ctor(const fn_call& fn)
+capabilities_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Capabilities_as;
 

=== modified file 'libcore/asobj/flash/system/IMEConversionMode_as.cpp'
--- a/libcore/asobj/flash/system/IMEConversionMode_as.cpp       2009-07-14 
11:18:42 +0000
+++ b/libcore/asobj/flash/system/IMEConversionMode_as.cpp       2009-07-15 
09:33:59 +0000
@@ -51,7 +51,7 @@
 namespace {
 
 void
-attachIMEConversionModeStaticInterface(as_object& o)
+attachIMEConversionModeStaticInterface(as_object& /*o*/)
 {
     // TODO: add constants here.
 }

=== modified file 'libcore/asobj/flash/system/IME_as.cpp'
--- a/libcore/asobj/flash/system/IME_as.cpp     2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/system/IME_as.cpp     2009-07-15 09:33:59 +0000
@@ -79,7 +79,7 @@
 }
 
 void
-attachIMEStaticInterface(as_object& o)
+attachIMEStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -115,7 +115,7 @@
 }
 
 as_value
-ime_ctor(const fn_call& fn)
+ime_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IME_as;
 

=== modified file 'libcore/asobj/flash/system/LoaderContext_as.cpp'
--- a/libcore/asobj/flash/system/LoaderContext_as.cpp   2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/system/LoaderContext_as.cpp   2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachLoaderContextInterface(as_object& o)
+attachLoaderContextInterface(as_object& /*o*/)
 {
 }
 
 void
-attachLoaderContextStaticInterface(as_object& o)
+attachLoaderContextStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-loadercontext_ctor(const fn_call& fn)
+loadercontext_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new LoaderContext_as;
 

=== modified file 'libcore/asobj/flash/system/SecurityDomain_as.cpp'
--- a/libcore/asobj/flash/system/SecurityDomain_as.cpp  2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/system/SecurityDomain_as.cpp  2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachSecurityDomainInterface(as_object& o)
+attachSecurityDomainInterface(as_object& /*o*/)
 {
 }
 
 void
-attachSecurityDomainStaticInterface(as_object& o)
+attachSecurityDomainStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-securitydomain_ctor(const fn_call& fn)
+securitydomain_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new SecurityDomain_as;
 

=== modified file 'libcore/asobj/flash/system/SecurityPanel_as.cpp'
--- a/libcore/asobj/flash/system/SecurityPanel_as.cpp   2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/system/SecurityPanel_as.cpp   2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachSecurityPanelInterface(as_object& o)
+attachSecurityPanelInterface(as_object& /*o*/)
 {
 }
 
 void
-attachSecurityPanelStaticInterface(as_object& o)
+attachSecurityPanelStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-securitypanel_ctor(const fn_call& fn)
+securitypanel_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new SecurityPanel_as;
 

=== modified file 'libcore/asobj/flash/system/Security_as.cpp'
--- a/libcore/asobj/flash/system/Security_as.cpp        2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/system/Security_as.cpp        2009-07-15 09:33:59 
+0000
@@ -89,7 +89,7 @@
 }
 
 void
-attachSecurityStaticInterface(as_object& o)
+attachSecurityStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -175,7 +175,7 @@
 }
 
 as_value
-security_ctor(const fn_call& fn)
+security_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Security_as;
 

=== modified file 'libcore/asobj/flash/text/AntiAliasType_as.cpp'
--- a/libcore/asobj/flash/text/AntiAliasType_as.cpp     2009-07-14 11:18:42 
+0000
+++ b/libcore/asobj/flash/text/AntiAliasType_as.cpp     2009-07-15 09:33:59 
+0000
@@ -51,7 +51,7 @@
 namespace {
 
 void
-attachAntiAliasTypeStaticInterface(as_object& o)
+attachAntiAliasTypeStaticInterface(as_object& /*o*/)
 {
     // TODO: add constants here.
 }

=== modified file 'libcore/asobj/flash/text/CSMSettings_as.cpp'
--- a/libcore/asobj/flash/text/CSMSettings_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/text/CSMSettings_as.cpp       2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachCSMSettingsInterface(as_object& o)
+attachCSMSettingsInterface(as_object& /*o*/)
 {
 }
 
 void
-attachCSMSettingsStaticInterface(as_object& o)
+attachCSMSettingsStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-csmsettings_ctor(const fn_call& fn)
+csmsettings_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new CSMSettings_as;
 

=== modified file 'libcore/asobj/flash/text/FontStyle_as.cpp'
--- a/libcore/asobj/flash/text/FontStyle_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/text/FontStyle_as.cpp 2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachFontStyleInterface(as_object& o)
+attachFontStyleInterface(as_object& /*o*/)
 {
 }
 
 void
-attachFontStyleStaticInterface(as_object& o)
+attachFontStyleStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-fontstyle_ctor(const fn_call& fn)
+fontstyle_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new FontStyle_as;
 

=== modified file 'libcore/asobj/flash/text/FontType_as.cpp'
--- a/libcore/asobj/flash/text/FontType_as.cpp  2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/text/FontType_as.cpp  2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachFontTypeInterface(as_object& o)
+attachFontTypeInterface(as_object& /*o*/)
 {
 }
 
 void
-attachFontTypeStaticInterface(as_object& o)
+attachFontTypeStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-fonttype_ctor(const fn_call& fn)
+fonttype_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new FontType_as;
 

=== modified file 'libcore/asobj/flash/text/Font_as.cpp'
--- a/libcore/asobj/flash/text/Font_as.cpp      2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/text/Font_as.cpp      2009-07-15 09:33:59 +0000
@@ -115,7 +115,7 @@
 }
 
 as_value
-font_ctor(const fn_call& fn)
+font_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Font_as;
 

=== modified file 'libcore/asobj/flash/text/StaticText_as.cpp'
--- a/libcore/asobj/flash/text/StaticText_as.cpp        2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/text/StaticText_as.cpp        2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachStaticTextInterface(as_object& o)
+attachStaticTextInterface(as_object& /*o*/)
 {
 }
 
 void
-attachStaticTextStaticInterface(as_object& o)
+attachStaticTextStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-statictext_ctor(const fn_call& fn)
+statictext_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new StaticText_as;
 

=== modified file 'libcore/asobj/flash/text/StyleSheet_as.cpp'
--- a/libcore/asobj/flash/text/StyleSheet_as.cpp        2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/text/StyleSheet_as.cpp        2009-07-15 09:33:59 
+0000
@@ -83,7 +83,7 @@
 }
 
 void
-attachStyleSheetStaticInterface(as_object& o)
+attachStyleSheetStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -139,7 +139,7 @@
 }
 
 as_value
-stylesheet_ctor(const fn_call& fn)
+stylesheet_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new StyleSheet_as;
 

=== modified file 'libcore/asobj/flash/text/TextField_as.cpp'
--- a/libcore/asobj/flash/text/TextField_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/text/TextField_as.cpp 2009-07-15 09:33:59 +0000
@@ -332,7 +332,7 @@
 }
 
 as_value
-textfield_ctor(const fn_call& fn)
+textfield_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new TextField_as;
 

=== modified file 'libcore/asobj/flash/text/TextFormat_as.cpp'
--- a/libcore/asobj/flash/text/TextFormat_as.cpp        2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/text/TextFormat_as.cpp        2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachTextFormatInterface(as_object& o)
+attachTextFormatInterface(as_object& /*o*/)
 {
 }
 
 void
-attachTextFormatStaticInterface(as_object& o)
+attachTextFormatStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-textformat_ctor(const fn_call& fn)
+textformat_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new TextFormat_as;
 

=== modified file 'libcore/asobj/flash/text/TextLineMetrics_as.cpp'
--- a/libcore/asobj/flash/text/TextLineMetrics_as.cpp   2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/text/TextLineMetrics_as.cpp   2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachTextLineMetricsInterface(as_object& o)
+attachTextLineMetricsInterface(as_object& /*o*/)
 {
 }
 
 void
-attachTextLineMetricsStaticInterface(as_object& o)
+attachTextLineMetricsStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-textlinemetrics_ctor(const fn_call& fn)
+textlinemetrics_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new TextLineMetrics_as;
 

=== modified file 'libcore/asobj/flash/text/text_pkg.cpp'
--- a/libcore/asobj/flash/text/text_pkg.cpp     2009-07-14 06:01:56 +0000
+++ b/libcore/asobj/flash/text/text_pkg.cpp     2009-07-15 09:33:59 +0000
@@ -49,32 +49,32 @@
 namespace gnash {
 
 static as_value
-get_flash_text_package(const fn_call& fn)
+get_flash_text_package(const fn_call& /*fn*/)
 {
-       log_debug("Loading flash.text package");
+    log_debug("Loading flash.text package");
     
     as_object *pkg = new as_object(getObjectInterface());
 
-       // Call the [objectname]_init() function for each class.
-       int i = 0;
+    // Call the [objectname]_init() function for each class.
+    int i = 0;
 
     while (textclasses[i]) {
         textclasses[i](*pkg);
         ++i;
     }
 
-       return pkg;
+    return pkg;
 }
 
 void
 flash_text_package_init(as_object& where)
 {
-       string_table& st = getStringTable(where);
+    string_table& st = getStringTable(where);
 
     // TODO: this may not be correct, but it should be enumerable.
     const int flags = 0;
-       where.init_destructive_property(st.find("text"),
-                       get_flash_text_package, flags);
+    where.init_destructive_property(st.find("text"),
+            get_flash_text_package, flags);
 }
 
 

=== modified file 'libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp'
--- a/libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp     2009-07-14 
13:40:32 +0000
+++ b/libcore/asobj/flash/ui/ContextMenuBuiltInItems_as.cpp     2009-07-15 
09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachContextMenuBuiltInItemsInterface(as_object& o)
+attachContextMenuBuiltInItemsInterface(as_object& /*o*/)
 {
 }
 
 void
-attachContextMenuBuiltInItemsStaticInterface(as_object& o)
+attachContextMenuBuiltInItemsStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-contextmenubuiltinitems_ctor(const fn_call& fn)
+contextmenubuiltinitems_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ContextMenuBuiltInItems_as;
 

=== modified file 'libcore/asobj/flash/ui/ContextMenu_as.cpp'
--- a/libcore/asobj/flash/ui/ContextMenu_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/ui/ContextMenu_as.cpp 2009-07-14 15:39:12 +0000
@@ -142,7 +142,7 @@
     as_object* nc = new Array_as;
     as_object* customs;
 
-    if (customItems.is_object() && (customs = customItems.to_object().get())) {
+    if (customItems.is_object() && (customs = 
customItems.to_object(*getGlobal(fn)).get())) {
         // TODO: only copy properties that are ContextMenuItems.
         nc->copyProperties(*customs);
         customItems = nc;

=== modified file 'libcore/asobj/flash/ui/KeyLocation_as.cpp'
--- a/libcore/asobj/flash/ui/KeyLocation_as.cpp 2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/ui/KeyLocation_as.cpp 2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachKeyLocationInterface(as_object& o)
+attachKeyLocationInterface(as_object& /*o*/)
 {
 }
 
 void
-attachKeyLocationStaticInterface(as_object& o)
+attachKeyLocationStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-keylocation_ctor(const fn_call& fn)
+keylocation_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new KeyLocation_as;
 

=== modified file 'libcore/asobj/flash/ui/Mouse_as.cpp'
--- a/libcore/asobj/flash/ui/Mouse_as.cpp       2009-07-14 09:11:14 +0000
+++ b/libcore/asobj/flash/ui/Mouse_as.cpp       2009-07-14 15:39:12 +0000
@@ -71,7 +71,6 @@
 void
 attachMouseInterface(as_object& o)
 {
-    Global_as* gl = getGlobal(o);
     VM& vm = getVM(o);
 
     const int flags = as_prop_flags::dontEnum |

=== modified file 'libcore/asobj/flash/utils/ByteArray_as.cpp'
--- a/libcore/asobj/flash/utils/ByteArray_as.cpp        2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/utils/ByteArray_as.cpp        2009-07-15 09:33:59 
+0000
@@ -427,7 +427,7 @@
 }
 
 as_value
-bytearray_ctor(const fn_call& fn)
+bytearray_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new ByteArray_as;
 

=== modified file 'libcore/asobj/flash/utils/Dictionary_as.cpp'
--- a/libcore/asobj/flash/utils/Dictionary_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/utils/Dictionary_as.cpp       2009-07-15 09:33:59 
+0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachDictionaryInterface(as_object& o)
+attachDictionaryInterface(as_object& /*o*/)
 {
 }
 
 void
-attachDictionaryStaticInterface(as_object& o)
+attachDictionaryStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-dictionary_ctor(const fn_call& fn)
+dictionary_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Dictionary_as;
 

=== modified file 'libcore/asobj/flash/utils/Endian_as.cpp'
--- a/libcore/asobj/flash/utils/Endian_as.cpp   2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/utils/Endian_as.cpp   2009-07-15 09:33:59 +0000
@@ -69,12 +69,12 @@
 namespace {
 
 void
-attachEndianInterface(as_object& o)
+attachEndianInterface(as_object& /*o*/)
 {
 }
 
 void
-attachEndianStaticInterface(as_object& o)
+attachEndianStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -91,7 +91,7 @@
 }
 
 as_value
-endian_ctor(const fn_call& fn)
+endian_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Endian_as;
 

=== modified file 'libcore/asobj/flash/utils/IDataInput_as.cpp'
--- a/libcore/asobj/flash/utils/IDataInput_as.cpp       2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/utils/IDataInput_as.cpp       2009-07-15 09:33:59 
+0000
@@ -247,7 +247,7 @@
 }
 
 as_value
-idatainput_ctor(const fn_call& fn)
+idatainput_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IDataInput_as;
 

=== modified file 'libcore/asobj/flash/utils/IDataOutput_as.cpp'
--- a/libcore/asobj/flash/utils/IDataOutput_as.cpp      2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/utils/IDataOutput_as.cpp      2009-07-15 09:33:59 
+0000
@@ -223,7 +223,7 @@
 }
 
 as_value
-idataoutput_ctor(const fn_call& fn)
+idataoutput_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IDataOutput_as;
 

=== modified file 'libcore/asobj/flash/utils/IExternalizable_as.cpp'
--- a/libcore/asobj/flash/utils/IExternalizable_as.cpp  2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/utils/IExternalizable_as.cpp  2009-07-15 09:33:59 
+0000
@@ -103,7 +103,7 @@
 }
 
 as_value
-iexternalizable_ctor(const fn_call& fn)
+iexternalizable_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new IExternalizable_as;
 

=== modified file 'libcore/asobj/flash/utils/Proxy_as.cpp'
--- a/libcore/asobj/flash/utils/Proxy_as.cpp    2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/utils/Proxy_as.cpp    2009-07-15 09:33:59 +0000
@@ -93,7 +93,7 @@
 }
 
 void
-attachProxyStaticInterface(as_object& o)
+attachProxyStaticInterface(as_object& /*o*/)
 {
 
 }
@@ -200,7 +200,7 @@
 }
 
 as_value
-proxy_ctor(const fn_call& fn)
+proxy_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Proxy_as;
 

=== modified file 'libcore/asobj/flash/utils/Timer_as.cpp'
--- a/libcore/asobj/flash/utils/Timer_as.cpp    2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/utils/Timer_as.cpp    2009-07-15 09:33:59 +0000
@@ -83,7 +83,7 @@
 }
 
 void
-attachTimerStaticInterface(as_object& o)
+attachTimerStaticInterface(as_object& /*o*/)
 {
 }
 
@@ -139,7 +139,7 @@
 }
 
 as_value
-timer_ctor(const fn_call& fn)
+timer_ctor(const fn_call& /*fn*/)
 {
     boost::intrusive_ptr<as_object> obj = new Timer_as;
 

=== modified file 'libcore/asobj/flash/xml/XMLDocument_as.cpp'
--- a/libcore/asobj/flash/xml/XMLDocument_as.cpp        2009-07-14 13:40:32 
+0000
+++ b/libcore/asobj/flash/xml/XMLDocument_as.cpp        2009-07-14 15:39:12 
+0000
@@ -705,7 +705,7 @@
     {
         if ( fn.arg(0).is_object() )
         {
-            boost::intrusive_ptr<as_object> obj = fn.arg(0).to_object();
+            boost::intrusive_ptr<as_object> obj = 
fn.arg(0).to_object(*getGlobal(fn));
             xml_obj = dynamic_cast<XMLDocument_as*>(obj.get());
             if ( xml_obj )
             {

=== modified file 'libcore/asobj/flash/xml/XMLNode_as.cpp'
--- a/libcore/asobj/flash/xml/XMLNode_as.cpp    2009-07-14 13:40:32 +0000
+++ b/libcore/asobj/flash/xml/XMLNode_as.cpp    2009-07-14 15:39:12 +0000
@@ -544,7 +544,7 @@
        }
 
        boost::intrusive_ptr<XMLNode_as> xml_obj = 
-        boost::dynamic_pointer_cast<XMLNode_as>(fn.arg(0).to_object());        
+        
boost::dynamic_pointer_cast<XMLNode_as>(fn.arg(0).to_object(*getGlobal(fn)));  
        if ( ! xml_obj )
        {
                IF_VERBOSE_ASCODING_ERRORS(
@@ -588,7 +588,7 @@
        }
 
        boost::intrusive_ptr<XMLNode_as> newnode = 
-        boost::dynamic_pointer_cast<XMLNode_as>(fn.arg(0).to_object());
+        
boost::dynamic_pointer_cast<XMLNode_as>(fn.arg(0).to_object(*getGlobal(fn)));
 
        if (!newnode) {
                IF_VERBOSE_ASCODING_ERRORS(
@@ -600,7 +600,7 @@
        }
 
        boost::intrusive_ptr<XMLNode_as> pos = 
-        boost::dynamic_pointer_cast<XMLNode_as>(fn.arg(1).to_object());
+        
boost::dynamic_pointer_cast<XMLNode_as>(fn.arg(1).to_object(*getGlobal(fn)));
 
        if (!pos) {
                IF_VERBOSE_ASCODING_ERRORS(

=== modified file 'libcore/debugger.cpp'
--- a/libcore/debugger.cpp      2009-06-15 11:32:49 +0000
+++ b/libcore/debugger.cpp      2009-07-14 15:39:12 +0000
@@ -571,7 +571,7 @@
 // FIXME: we want to print the name of the function
 //         if (val.is_as_function()) {
 // //          cerr << val.get_symbol_handle() << endl;
-//             string name = this->lookupSymbol(val.to_object());
+//             string name = this->lookupSymbol(val.to_object(*getGlobal(fn)));
 //             if (name.size()) {
 //                 cerr << name << " ";
 //             }
@@ -579,7 +579,7 @@
         cerr << env.bottom(i);
 
            if (val.is_object()) {
-               boost::intrusive_ptr<as_object> o = val.to_object();
+               boost::intrusive_ptr<as_object> o = 
val.to_object(*getGlobal(fn));
                string name = lookupSymbol(o.get());
                if (name.size()) {
                    cerr << " \"" << name << "\"";

=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp    2009-07-14 07:23:01 +0000
+++ b/libcore/movie_root.cpp    2009-07-15 09:09:52 +0000
@@ -511,13 +511,13 @@
 as_object*
 movie_root::getSelectionObject() const
 {
-    as_object* global = _vm.getGlobal();
+    Global_as* global = _vm.getGlobal();
     if (!global) return 0;
 
     as_value s;
     if (!global->get_member(NSV::CLASS_SELECTION, &s)) return 0;
     
-    as_object* sel = s.to_object().get();
+    as_object* sel = s.to_object(*global).get();
    
     return sel;
 }
@@ -527,10 +527,10 @@
 {
        as_value v;
        assert ( VM::isInitialized() ); // return NULL;
-       as_object* global = _vm.getGlobal();
+       Global_as* global = _vm.getGlobal();
        if ( ! global ) return NULL;
        if (!global->get_member(NSV::PROP_iSTAGE, &v) ) return NULL;
-       return boost::dynamic_pointer_cast<Stage_as>(v.to_object());
+       return boost::dynamic_pointer_cast<Stage_as>(v.to_object(*global));
 }
                
 void
@@ -579,11 +579,11 @@
                // TODO: use a named string...
 
                as_value kval;
-               as_object* global = _vm.getGlobal();
+               Global_as* global = _vm.getGlobal();
 
                if (global->get_member(NSV::CLASS_KEY, &kval)) {
 
-                       boost::intrusive_ptr<as_object> obj = kval.to_object();
+                       boost::intrusive_ptr<as_object> obj = 
kval.to_object(*global);
                        _keyobject = boost::dynamic_pointer_cast<Keyboard_as>( 
obj );
                }
        }
@@ -599,12 +599,12 @@
        if ( ! _mouseobject )
        {
                as_value val;
-               as_object* global = _vm.getGlobal();
+               Global_as* global = _vm.getGlobal();
 
                if (global->get_member(NSV::CLASS_MOUSE, &val) )
                {
                        //log_debug("Found member 'Mouse' in _global: %s", val);
-                       _mouseobject = val.to_object();
+                       _mouseobject = val.to_object(*global);
                }
        }
 
@@ -1013,7 +1013,8 @@
 
     try {
 
-        int elapsed = now - _lastMovieAdvancement;
+        assert(now >= _lastMovieAdvancement);
+        size_t elapsed = now - _lastMovieAdvancement;
            if (elapsed >= _movieAdvancementDelay)
            {
             advanced = true;

=== modified file 'libcore/swf_function.cpp'
--- a/libcore/swf_function.cpp  2009-07-14 07:32:50 +0000
+++ b/libcore/swf_function.cpp  2009-07-15 07:37:56 +0000
@@ -41,7 +41,7 @@
 #endif 
 }
 
-swf_function::swf_function(const action_buffer* ab, as_environment* env,
+swf_function::swf_function(const action_buffer& ab, as_environment& env,
                        size_t start, const ScopeStack& scopeStack)
        :
        as_function(new as_object(getObjectInterface())),
@@ -54,8 +54,7 @@
        m_local_register_count(0),
        m_function2_flags(0)
 {
-       assert(m_action_buffer);
-       assert( m_start_pc < m_action_buffer->size() );
+       assert( m_start_pc < m_action_buffer.size() );
 
        init_member("constructor", 
             as_value(as_function::getFunctionConstructor().get()));
@@ -130,15 +129,11 @@
     CallStack& cs = vm.getCallStack();
     if ( ! cs.empty() ) caller = cs.back().func;
 
-       assert(m_env);
-
        // Set up local stack frame, for parameters and locals.
-       as_environment::FrameGuard guard(*m_env, this);
-
-       as_environment* our_env = m_env;
-
-       DisplayObject* target = our_env->get_target();
-       DisplayObject* orig_target = our_env->get_original_target();
+       as_environment::FrameGuard guard(m_env, this);
+
+       DisplayObject* target = m_env.get_target();
+       DisplayObject* orig_target = m_env.get_original_target();
 
        // Some features are version-dependant.
        unsigned swfversion = vm.getSWFVersion();
@@ -146,8 +141,6 @@
        if (swfversion > 5)
        {
                super = fn.super;
-               //if ( super ) log_debug("Super is %s @ %p", typeName(*super), 
(void*)super);
-               //else log_debug("Super is not available");
        }
        else
        {
@@ -174,7 +167,7 @@
        /// TODO: test scope when calling functions defined in another timeline
        ///       (target, in particular).
        ///
-       TargetGuard targetGuard(*our_env, target, orig_target);
+       TargetGuard targetGuard(m_env, target, orig_target);
 
        if (m_is_function2 == false)
        {
@@ -186,36 +179,36 @@
                        assert(m_args[i].m_register == 0);
                        if ( i < fn.nargs )
                        {
-                               our_env->add_local(m_args[i].m_name, fn.arg(i));
+                               m_env.add_local(m_args[i].m_name, fn.arg(i));
                        }
                        else
                        {
                                // Still declare named arguments, even if
                                // they are not passed from caller
                                // See bug #22203
-                               our_env->declare_local(m_args[i].m_name);
+                               m_env.declare_local(m_args[i].m_name);
                        }
                }
 
                // Add 'this'
                assert(fn.this_ptr);
-               our_env->set_local("this", fn.this_ptr);
+               m_env.set_local("this", fn.this_ptr);
 
                // Add 'super' (SWF6+ only)
                if ( super && swfversion > 5 )
                {
-                       our_env->set_local("super", as_value(super));
+                       m_env.set_local("super", as_value(super));
                }
 
                // Add 'arguments'
-               our_env->set_local("arguments", getArguments(*this, fn, 
caller));
+               m_env.set_local("arguments", getArguments(*this, fn, caller));
        }
        else
        {
                // function2: most args go in registers; any others get pushed.
                
                // Create local registers.
-               our_env->add_local_registers(m_local_register_count);
+               m_env.add_local_registers(m_local_register_count);
 
                // Handle the implicit args.
                // @@ why start at 1 ? Note that starting at 0 makes    
@@ -224,7 +217,7 @@
                if ( (m_function2_flags & PRELOAD_THIS) && ! (m_function2_flags 
& SUPPRESS_THIS) )
                {
                        // preload 'this' into a register.
-                       our_env->setRegister(current_reg, 
as_value(fn.this_ptr)); 
+                       m_env.setRegister(current_reg, as_value(fn.this_ptr)); 
                        current_reg++;
                }
 
@@ -235,7 +228,7 @@
                else
                {
                        // Put 'this' in a local var.
-                       our_env->add_local("this", as_value(fn.this_ptr));
+                       m_env.add_local("this", as_value(fn.this_ptr));
                }
 
                // Init arguments array, if it's going to be needed.
@@ -248,8 +241,7 @@
                if (m_function2_flags & PRELOAD_ARGUMENTS)
                {
                        // preload 'arguments' into a register.
-                       
//our_env->local_register(current_reg).set_as_object(arg_array.get());
-                       our_env->setRegister(current_reg, 
as_value(arg_array.get()));
+                       m_env.setRegister(current_reg, 
as_value(arg_array.get()));
                        current_reg++;
                }
 
@@ -260,7 +252,7 @@
                else
                {
                        // Put 'arguments' in a local var.
-                       our_env->add_local("arguments", 
as_value(arg_array.get()));
+                       m_env.add_local("arguments", as_value(arg_array.get()));
                }
 
                if ( (m_function2_flags & PRELOAD_SUPER) && swfversion > 5)
@@ -268,8 +260,7 @@
                        // Put 'super' in a register (SWF6+ only).
                        // TOCHECK: should we still set it if not available ?
                        if ( super ) {
-                               
//our_env->local_register(current_reg).set_as_object(super);
-                               our_env->setRegister(current_reg, 
as_value(super));
+                               m_env.setRegister(current_reg, as_value(super));
                                current_reg++;
                        }
                }
@@ -282,18 +273,18 @@
                {
                        // TOCHECK: should we still set it if unavailable ?
                        // Put 'super' in a local var (SWF6+ only)
-                       our_env->add_local("super", as_value(super));
+                       m_env.add_local("super", as_value(super));
                }
 
                if (m_function2_flags & PRELOAD_ROOT) 
                {
                        // Put '_root' (if any) in a register.
-                       DisplayObject* tgtch = our_env->get_target();
+                       DisplayObject* tgtch = m_env.get_target();
                        if ( tgtch )
                        {
                                // NOTE: _lockroot will be hanlded by 
getAsRoot()
                                as_object* r = tgtch->getAsRoot();
-                               our_env->setRegister(current_reg, as_value(r));
+                               m_env.setRegister(current_reg, as_value(r));
                                current_reg++;
                        }
                }
@@ -301,9 +292,9 @@
                if (m_function2_flags & PRELOAD_PARENT)
                {
                        // Put '_parent' in a register.
-                       as_value parent = our_env->get_variable("_parent");
-                       //our_env->local_register(current_reg) = parent;
-                       our_env->setRegister(current_reg, parent);
+                       as_value parent = m_env.get_variable("_parent");
+                       //m_env.local_register(current_reg) = parent;
+                       m_env.setRegister(current_reg, parent);
                        current_reg++;
                }
 
@@ -311,8 +302,8 @@
                {
                        // Put '_global' in a register.
                        as_object* global = vm.getGlobal();
-                       
//our_env->local_register(current_reg).set_as_object(global);
-                       our_env->setRegister(current_reg, as_value(global));
+                       
//m_env.local_register(current_reg).set_as_object(global);
+                       m_env.setRegister(current_reg, as_value(global));
                        current_reg++;
                }
 
@@ -326,14 +317,14 @@
                                if ( i < fn.nargs )
                                {
                                        // Conventional arg passing: create a 
local var.
-                                       our_env->add_local(m_args[i].m_name, 
fn.arg(i));
+                                       m_env.add_local(m_args[i].m_name, 
fn.arg(i));
                                }
                                else
                                {
                                        // Still declare named arguments, even 
if
                                        // they are not passed from caller
                                        // See bug #22203
-                                       
our_env->declare_local(m_args[i].m_name);
+                                       m_env.declare_local(m_args[i].m_name);
                                }
                        }
                        else
@@ -342,8 +333,8 @@
                                {
                                        // Pass argument into a register.
                                        int     reg = m_args[i].m_register;
-                                       //our_env->local_register(reg) = 
fn.arg(i);
-                                       our_env->setRegister(reg, fn.arg(i));
+                                       //m_env.local_register(reg) = fn.arg(i);
+                                       m_env.setRegister(reg, fn.arg(i));
                                }
                                else
                                {
@@ -362,7 +353,7 @@
        // in case of problems (most interesting action limits)
        try 
        {
-               ActionExec exec(*this, *our_env, &result, fn.this_ptr.get());
+               ActionExec exec(*this, m_env, &result, fn.this_ptr.get());
                exec();
        }
        catch (ActionLimitException& ale) // expected and sane 
@@ -388,9 +379,8 @@
 void
 swf_function::set_length(int len)
 {
-       assert(m_action_buffer);
        assert(len >= 0);
-       assert(m_start_pc+len <= m_action_buffer->size());
+       assert(m_start_pc+len <= m_action_buffer.size());
        m_length = len;
 }
 
@@ -405,7 +395,7 @@
                (*i)->setReachable();
        }
 
-       if ( m_env ) m_env->markReachableResources();
+       m_env.markReachableResources();
 
        // Invoke parent class marker
        markAsFunctionReachable(); 

=== modified file 'libcore/swf_function.h'
--- a/libcore/swf_function.h    2009-06-15 14:07:12 +0000
+++ b/libcore/swf_function.h    2009-07-15 07:37:56 +0000
@@ -46,10 +46,10 @@
 private:
 
        /// Action buffer containing the function definition
-       const action_buffer* m_action_buffer;
+       const action_buffer& m_action_buffer;
 
        /// @@ might need some kind of ref count here, but beware cycles
-       as_environment* m_env;
+       as_environment& m_env;
 
        typedef std::vector< boost::intrusive_ptr<as_object> > ScopeStack;
 
@@ -92,7 +92,8 @@
        ///       a reference on it!
        ///       
        ///
-       static Array_as* getArguments(swf_function& callee, const fn_call& fn, 
as_object* caller);
+       static Array_as* getArguments(swf_function& callee, const fn_call& fn,
+            as_object* caller);
 
 public:
 
@@ -133,41 +134,11 @@
 
        ~swf_function();
 
-       /// Default constructor
-       //
-       /// Creates a Function object inheriting
-       /// the Function interface (apply,call)
-       ///
-       //swf_function();
-
-       /// Construct a Built-in ActionScript class 
-       //
-       /// The provided export_iface as_object is what will end
-       /// up being the class's 'prototype' member, caller must
-       /// make sure to provide it with a 'constructor' member
-       /// pointing to the function that creates an instance of
-       /// that class.
-       /// All built-in classes derive from the Function
-       /// built-in class, whose exported interface will be 
-       /// accessible trought their __proto__ member.
-       ///
-       /// @param export_iface the exported interface
-       ///
-       //swf_function(as_object* export_iface);
-       // USE THE builtin_function instead!
-
        /// \brief
        /// Create an ActionScript function as defined in an
        /// action_buffer starting at offset 'start'
        //
-       /// NULL environment is allowed -- if so, then
-       /// functions will be executed in the caller's
-       /// environment, rather than the environment where they
-       /// were defined.
-       ///
-       swf_function(const action_buffer* ab,
-               as_environment* env,
-               size_t start,
+       swf_function(const action_buffer& ab, as_environment& env, size_t start,
                const ScopeStack& with_stack);
 
        const ScopeStack& getScopeStack() const
@@ -177,8 +148,7 @@
 
        const action_buffer& getActionBuffer() const
        {
-               assert(m_action_buffer);
-               return *m_action_buffer;
+               return m_action_buffer;
        }
 
        size_t getStartPC() const

=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2009-07-14 06:01:56 +0000
+++ b/libcore/vm/ASHandlers.cpp 2009-07-15 07:37:56 +0000
@@ -39,8 +39,6 @@
 #include "action_buffer.h"
 #include "as_object.h"
 #include "Object.h"
-#include "String_as.h" // for automatic as_value::STRING => String as object
-#include "Number_as.h" // for automatic as_value::NUMBER => Number as object
 #include "drag_state.h"
 #include "VM.h" // for getting the root
 #include "movie_root.h" // for set_drag_state (ActionStartDragMovie)
@@ -50,6 +48,7 @@
 #include "utf8.h"
 #include "StringPredicates.h" 
 #include "GnashNumeric.h"
+#include "Global_as.h"
 
 #include <string>
 #include <vector>
@@ -1407,14 +1406,12 @@
 void
 SWFHandlers::ActionCastOp(ActionExec& thread)
 {
-    
 
     as_environment& env = thread.env;
 
-    
-
     // Get the "instance"
-    boost::intrusive_ptr<as_object> instance = env.top(0).to_object();
+    boost::intrusive_ptr<as_object> instance = 
+        env.top(0).to_object(*getGlobal(thread.env));
 
     // Get the "super" function
     as_function* super = env.top(1).to_as_function();
@@ -1460,7 +1457,7 @@
     
 
     as_value objval = env.pop();
-    as_object *obj = objval.to_object().get();
+    as_object *obj = objval.to_object(*getGlobal(thread.env)).get();
     int count = static_cast<int>(env.pop().to_number());
     as_value a(1);
 
@@ -1481,7 +1478,7 @@
         );
         return;
     }
-    obj = protoval.to_object().get();
+    obj = protoval.to_object(*getGlobal(thread.env)).get();
     if (!obj)
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -1503,7 +1500,7 @@
     {
         as_value ctorval = env.pop();
 
-        as_object* ctor = ctorval.to_object().get();
+        as_object* ctor = ctorval.to_object(*getGlobal(thread.env)).get();
         if ( ! ctor )
         {
             IF_VERBOSE_ASCODING_ERRORS(
@@ -1518,7 +1515,7 @@
             );
             continue;
         }
-        as_object *inter = protoval.to_object().get();
+        as_object *inter = protoval.to_object(*getGlobal(thread.env)).get();
         if ( ! inter )
         {
             IF_VERBOSE_ASCODING_ERRORS(
@@ -2641,11 +2638,11 @@
         }
         else {
             as_value target = thread.getVariable(path);
-            obj = target.to_object();
+            obj = target.to_object(*getGlobal(thread.env));
             propertyname = var;
         }
     }
-    else obj = env.top(1).to_object();
+    else obj = env.top(1).to_object(*getGlobal(thread.env));
 
     if (!obj)
     {
@@ -2687,7 +2684,7 @@
     
     // Otherwise see if it's an object and delete it.
     as_value target = thread.getVariable(path);
-    boost::intrusive_ptr<as_object> obj = target.to_object();
+    boost::intrusive_ptr<as_object> obj = 
target.to_object(*getGlobal(thread.env));
 
     if (!obj)
     {
@@ -2747,7 +2744,7 @@
         log_error(_("ActionCallFunction: function name %s evaluated to "
                 "non-function value %s"), funcname, function);
         // Calling super ? 
-        boost::intrusive_ptr<as_object> obj = function.to_object();
+        boost::intrusive_ptr<as_object> obj = 
function.to_object(*getGlobal(thread.env));
         this_ptr = thread.getThisPointer();
         if (!obj->get_member(NSV::PROP_CONSTRUCTOR, &function) )
         {
@@ -2870,7 +2867,7 @@
 
 #ifdef USE_DEBUGGER
 #ifndef GNASH_USE_GC
-    // WARNING: new_obj.to_object() can return a newly allocated
+    // WARNING: new_obj.to_object(*getGlobal(thread.env)) can return a newly 
allocated
     //          thing into the intrusive_ptr, so the debugger
     //          will be left with a deleted object !!
     //          Rob: we don't want to use void pointers here..
@@ -2916,7 +2913,7 @@
     // Call the array constructor, to create an empty array.
     as_value result = array_new(fn_call(NULL, env));
 
-    boost::intrusive_ptr<as_object> ao = result.to_object();
+    boost::intrusive_ptr<as_object> ao = 
result.to_object(*getGlobal(thread.env));
     assert(ao);
 
     // Fill the elements with the initial values from the stack.
@@ -3018,7 +3015,7 @@
 
     env.top(0).set_undefined();
 
-    const boost::intrusive_ptr<as_object> obj = variable.to_object();
+    const boost::intrusive_ptr<as_object> obj = 
variable.to_object(*getGlobal(thread.env));
     if ( !obj || !variable.is_object() )
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -3233,7 +3230,7 @@
     as_value member_name = env.top(0);
     as_value target = env.top(1);
 
-    boost::intrusive_ptr<as_object> obj = target.to_object();
+    boost::intrusive_ptr<as_object> obj = 
target.to_object(*getGlobal(thread.env));
     if (!obj)
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -3278,7 +3275,7 @@
     
     as_environment& env = thread.env;
 
-    boost::intrusive_ptr<as_object> obj = env.top(2).to_object();
+    boost::intrusive_ptr<as_object> obj = 
env.top(2).to_object(*getGlobal(thread.env));
     const std::string& member_name = env.top(1).to_string();
     const as_value& member_value = env.top(0);
 
@@ -3369,7 +3366,7 @@
     bool hasMethodName = ((!method_name.is_undefined()) &&
             (!method_string.empty()) );
 
-    boost::intrusive_ptr<as_object> obj = obj_value.to_object();
+    boost::intrusive_ptr<as_object> obj = 
obj_value.to_object(*getGlobal(thread.env));
     if (!obj) {
         // SWF integrity check
         IF_VERBOSE_ASCODING_ERRORS(
@@ -3499,7 +3496,7 @@
         nargs = available_args;
     }
 
-    boost::intrusive_ptr<as_object> obj = obj_val.to_object();
+    boost::intrusive_ptr<as_object> obj = 
obj_val.to_object(*getGlobal(thread.env));
     if (!obj) {
         // SWF integrity check
         // FIXME, should this be log_swferror?  Or log_aserror?
@@ -3555,10 +3552,10 @@
     as_environment& env = thread.env;
 
     // Get the "super" function
-    as_object* super = env.top(0).to_object().get();
+    as_object* super = env.top(0).to_object(*getGlobal(thread.env)).get();
 
     // Get the "instance" (but avoid implicit conversion of primitive values!)
-    as_object* instance = env.top(1).is_object() ? 
env.top(1).to_object().get() : NULL;
+    as_object* instance = env.top(1).is_object() ? 
env.top(1).to_object(*getGlobal(thread.env)).get() : NULL;
 
     // Invalid args!
     if (!super || ! instance) {
@@ -3591,7 +3588,7 @@
     // as we copied that as_value.
     env.top(0).set_undefined();
 
-    const boost::intrusive_ptr<as_object> obj = obj_val.to_object();
+    const boost::intrusive_ptr<as_object> obj = 
obj_val.to_object(*getGlobal(thread.env));
     if ( !obj || !obj_val.is_object() )
     {
         IF_VERBOSE_ASCODING_ERRORS(
@@ -3774,8 +3771,8 @@
     // Code starts at thread.getNextPC() as the DefineFunction tag
     // contains name and args, while next tag is first tag
     // of the function body.
-    swf_function* func = new swf_function(
-        &code, &env, thread.getNextPC(), thread.getScopeStack());
+    swf_function* func = new swf_function(code, env, thread.getNextPC(),
+            thread.getScopeStack());
 
     func->set_is_function2();
 
@@ -3864,11 +3861,11 @@
         env.push(function_value);
     }
 #ifdef USE_DEBUGGER
-    // WARNING: function_value.to_object() can return a newly allocated
+    // WARNING: function_value.to_object(*getGlobal(thread.env)) can return a 
newly allocated
     //          thing into the intrusive_ptr, so the debugger
     //          will be left with a deleted object !!
     //          Rob: we don't want to use void pointers here..
-    boost::intrusive_ptr<as_object> o = function_value.to_object();
+    boost::intrusive_ptr<as_object> o = 
function_value.to_object(*getGlobal(thread.env));
 #ifndef GNASH_USE_GC
     o->add_ref(); // this will leak, but at least debugger won't end up
                   // with a dangling reference...
@@ -3948,8 +3945,8 @@
 #endif
 
     
-    as_value with_obj_val = env.pop().to_object();
-    boost::intrusive_ptr<as_object> with_obj = with_obj_val.to_object();
+    as_value with_obj_val = env.pop().to_object(*getGlobal(thread.env));
+    boost::intrusive_ptr<as_object> with_obj = 
with_obj_val.to_object(*getGlobal(thread.env));
 
     ++pc; // skip tag code
 
@@ -4015,8 +4012,8 @@
     // Code starts at thread.getNextPC() as the DefineFunction tag
     // contains name and args, while next tag is first tag
     // of the function body.
-    swf_function* func = new swf_function(
-        &code, &env, thread.getNextPC(), thread.getScopeStack());
+    swf_function* func = new swf_function(code, env, thread.getNextPC(),
+            thread.getScopeStack());
 
     size_t i = thread.getCurrentPC() + 3;
 
@@ -4065,11 +4062,11 @@
         //env.set_member(name, function_value);
         thread.setVariable(name, function_value);
 #ifdef USE_DEBUGGER
-        // WARNING: new_obj.to_object() can return a newly allocated
+        // WARNING: new_obj.to_object(*getGlobal(thread.env)) can return a 
newly allocated
         //          thing into the intrusive_ptr, so the debugger
         //          will be left with a deleted object !!
         //          Rob: we don't want to use void pointers here..
-        boost::intrusive_ptr<as_object> o = function_value.to_object();
+        boost::intrusive_ptr<as_object> o = 
function_value.to_object(*getGlobal(thread.env));
 #ifndef GNASH_USE_GC
         o->add_ref(); // this will leak, but at least debugger won't end up
                   // with a dandling reference...

=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp    2009-07-14 07:23:01 +0000
+++ b/libcore/vm/Machine.cpp    2009-07-14 15:33:46 +0000
@@ -173,11 +173,11 @@
        as_value *e = &vte;                                                     
                                                        \
        if (e->is_object())                                                     
                                                        \
        {                                                                       
                                                                        \
-               Property *b = e->to_object()->findProperty(NSV::PROP_VALUE_OF, 
0);      \
+               Property *b = 
e->to_object(*_global)->findProperty(NSV::PROP_VALUE_OF, 0);      \
                if (b)                                                          
                                                                \
                {                                                               
                                                                        \
                        mStream->seekTo(opStart);                               
                                                \
-                       pushGet(e->to_object().get(), *e, b);                   
                                \
+                       pushGet(e->to_object(*_global).get(), *e, b);           
                                        \
                        break;                                                  
                                                                \
                }                                                               
                                                                        \
        }                                                                       
                                                                        \
@@ -204,11 +204,11 @@
        as_value *c = &vte; /* Don't call vte multiple times */                 
                \
        if (c->is_object())                                                     
                                                        \
        {                                                                       
                                                                        \
-               Property *d = c->to_object()->findProperty(NSV::PROP_TO_STRING, 
0);     \
+               Property *d = 
c->to_object(*_global)->findProperty(NSV::PROP_TO_STRING, 0);     \
                if (d)                                                          
                                                                \
                {                                                               
                                                                        \
                        mStream->seekTo(opStart);                               
                                                \
-                       pushGet(c->to_object().get(), *c, d);                   
                                \
+                       pushGet(c->to_object(*_global).get(), *c, d);           
                                        \
                        break;                                                  
                                                                \
                }                                                               
                                                                        \
        }                                                                       
                                                                        \
@@ -264,7 +264,7 @@
        if (b.is_object())                                                      
                                                        \
        {                                                                       
                                                                        \
                as_value v;                                                     
                                                                \
-               b.to_object()->get_member(NSV::INTERNAL_TYPE, &v);              
                        \
+               b.to_object(*_global)->get_member(NSV::INTERNAL_TYPE, &v);      
                                \
                if (!a.conforms_to(mST.find(v.to_string())))                    
                        \
                        *store = false;                                         
                                                        \
        }                                                                       
                                                                        \
@@ -345,6 +345,16 @@
 }
 
 void
+Machine::push_scope_stack(as_value object)
+{
+    boost::intrusive_ptr<as_object> scopeObj = object.to_object(*_global);
+    assert(scopeObj.get());
+    log_abc("Pushing value %s onto scope stack.", object);
+    _scopeStack.push(scopeObj);
+    print_scope_stack();
+}
+
+void
 Machine::execute()
 {
 
@@ -416,7 +426,7 @@
                     ENSURE_OBJECT(_stack.top(0));
                     
                     // Use get_super?
-                    as_object *super = _stack.top(0).to_object()->
+                    as_object *super = _stack.top(0).to_object(*_global)->
                         get_prototype().get();
                     
                     // If we don't have a super, throw.
@@ -448,7 +458,7 @@
                     ENSURE_OBJECT(_stack.top(0));
                     
                     // Use get_super?
-                    as_object* super = _stack.pop().to_object()->
+                    as_object* super = _stack.pop().to_object(*_global)->
                         get_prototype().get();
                     if (!super) throw ASReferenceError();
                     Property* b = super->findProperty(a.getABCName(), 
@@ -848,7 +858,7 @@
                 case SWF::ABC_ACTION_PUSHSCOPE:
                 {
                     as_value scope_value = pop_stack();
-                    if (!scope_value.to_object().get()) {
+                    if (!scope_value.to_object(*_global).get()) {
                         IF_VERBOSE_ASCODING_ERRORS(
                         log_aserror(_("Can't push a null value onto the "
                                 "scope stack (%s)."), scope_value);
@@ -871,7 +881,7 @@
                     log_unimpl("ABC_ACTION_PUSHWITH");
                     // A scope object is just a regular object.
             //                 ENSURE_OBJECT(_stack.top(0));
-            //                 as_object *a = _stack.top(0).to_object().get();
+            //                 as_object *a = 
_stack.top(0).to_object(*_global).get();
             // 
             //                 if (!_scopeStack.empty())
             //                         
a->set_prototype(_scopeStack.top(0).mScope);
@@ -911,7 +921,7 @@
                 {
                     ENSURE_NUMBER(_stack.top(0));
                     ENSURE_OBJECT(_stack.top(1));
-                    as_object *obj = _stack.top(1).to_object().get();
+                    as_object *obj = _stack.top(1).to_object(*_global).get();
                     const boost::uint32_t index =
                         _stack.top(0).to_number<boost::uint32_t>();
                     
@@ -943,7 +953,7 @@
                 {
                     ENSURE_NUMBER(_stack.top(0));
                     ENSURE_OBJECT(_stack.top(1));
-                    as_object *obj = _stack.top(1).to_object().get();
+                    as_object *obj = _stack.top(1).to_object(*_global).get();
                     boost::uint32_t index =
                         _stack.top(0).to_number<boost::uint32_t>();
                     _stack.drop(1);
@@ -983,7 +993,7 @@
                 {
                     ENSURE_NUMBER(_stack.top(0));
                     ENSURE_OBJECT(_stack.top(1));
-                    as_object *obj = _stack.top(1).to_object().get();
+                    as_object *obj = _stack.top(1).to_object(*_global).get();
                     const boost::uint32_t index =
                         _stack.top(0).to_number<boost::uint32_t>();
                     const Property *b = obj->getByIndex(index);
@@ -1150,7 +1160,7 @@
                     log_abc("HASNEXT2: Object is %s, index is %d",
                             objv, indexv);
 
-                    as_object *obj = objv.to_object().get();
+                    as_object *obj = objv.to_object(*_global).get();
                     if (!obj) {
                         // TODO: Check what to do here.
                         log_error("ABC_ACTION_HASNEXT2: expecting object in "
@@ -1217,7 +1227,7 @@
                     ENSURE_OBJECT(_stack.top(argc + 1)); // The func
                     ENSURE_OBJECT(_stack.top(argc)); // The 'this'
                     as_function *f = _stack.top(argc + 1).to_as_function();
-                    as_object *obj = _stack.top(argc).to_object().get();
+                    as_object *obj = 
_stack.top(argc).to_object(*_global).get();
                     // We start with argc + 2 values related to this call
                     // on the stack. We want to end with 1 value. We pass
                     // argc values (the parameters), so we need to drop
@@ -1264,7 +1274,7 @@
                     boost::uint32_t dispatch_id = mStream->read_V32() - 1;
                     boost::uint32_t argc = mStream->read_V32();
                     ENSURE_OBJECT(_stack.top(argc));
-                    as_object *obj = _stack.top(argc).to_object().get();
+                    as_object *obj = 
_stack.top(argc).to_object(*_global).get();
                     const Property *f = obj->getByIndex(dispatch_id);
                     as_function* func;
 #if 0
@@ -1300,7 +1310,7 @@
                     boost::uint32_t argc = mStream->read_V32();
                     as_function *func = m->getPrototype();
                     ENSURE_OBJECT(_stack.top(argc));
-                    as_object *obj = _stack.top(argc).to_object().get();
+                    as_object *obj = 
_stack.top(argc).to_object(*_global).get();
                     pushCall(func, obj, _stack.top(argc), argc, 0);
                     break;
                 }
@@ -1326,7 +1336,7 @@
 
                     // Why get_super() here and get_prototype everywhere else?
                     as_object* super =
-                        _stack.top(argc).to_object()->get_super();
+                        _stack.top(argc).to_object(*_global)->get_super();
 
                     if (!super) throw ASReferenceError();
                     
@@ -1382,7 +1392,7 @@
 
                     as_value object_val = pop_stack();
 
-                    as_object *object = object_val.to_object().get();
+                    as_object *object = object_val.to_object(*_global).get();
                     if (!object) {
                         log_abc(_("CALLPROP: Can't call a method of a value "
                                 "that doesn't cast to an object (%s)."),
@@ -1415,7 +1425,7 @@
 
             /*         int shift = completeName(a, argc);
                     ENSURE_OBJECT(_stack.top(shift + argc));
-                    as_object *obj = _stack.top(argc + 
shift).to_object().get();
+                    as_object *obj = _stack.top(argc + 
shift).to_object(*_global).get();
                     Property *b = obj->findProperty(a.getABCName(), 
                         a.getNamespace()->getURI());
                     if (!b)
@@ -1489,7 +1499,7 @@
                     boost::uint32_t argc = mStream->read_V32();
                     get_args(argc);
                     
-                    as_object* obj = _stack.top(argc).to_object().get();
+                    as_object* obj = 
_stack.top(argc).to_object(*_global).get();
 
                     // Using get_super() here fails; is it broken, or is
                     // prototype what we want?
@@ -1531,7 +1541,7 @@
                             "%s on object %s", mST.value(a.getGlobalName()),
                             _stack.top(0));
 
-                    as_object* object = pop_stack().to_object().get();
+                    as_object* object = pop_stack().to_object(*_global).get();
 
                     if (!object) {
                         //TODO: Should this result in an exeception or an 
@@ -1570,10 +1580,10 @@
                             push_stack(as_value());
                         }
                         else {
-                            as_value val = c.to_object()->getMember(
+                            as_value val = c.to_object(*_global)->getMember(
                                     NSV::PROP_CONSTRUCTOR, 0);
 
-                            call_method(val, env, c.to_object().get(), args);
+                            call_method(val, env, c.to_object(*_global).get(), 
args);
 
                             // Push the constructed property
                             push_stack(c);
@@ -1672,7 +1682,7 @@
                             mST.value(c->getName()));
                     
                     // This may be 0, and that's fine.
-                    as_object* base_class = pop_stack().to_object().get();
+                    as_object* base_class = 
pop_stack().to_object(*_global).get();
                     as_object* new_class = c->getPrototype();
                     
                     new_class->set_prototype(base_class);
@@ -1841,7 +1851,7 @@
                     else name = a.getGlobalName();
 
                     as_value val = pop_stack();
-                    as_object *object = val.to_object().get();
+                    as_object *object = val.to_object(*_global).get();
 
                     if (!object) {
                         log_error("ABC_ACTION_SETPROPERTY: expecting object "
@@ -1929,7 +1939,7 @@
                     else name = a.getGlobalName();
 
                     as_value object_val = pop_stack();
-                    as_object* object = object_val.to_object().get();
+                    as_object* object = object_val.to_object(*_global).get();
                     
                     log_abc(_("GETPROPERTY: Looking for property "
                             "%s of object %s"), mST.value(name), object_val);
@@ -1977,7 +1987,7 @@
                     // pop name and namespace values.
                     as_value object_val = pop_stack();
 
-                    as_object* object = object_val.to_object().get();
+                    as_object* object = object_val.to_object(*_global).get();
                     if (!object) {
                         log_abc("INITPROPERTY: expecting object on stack, "
                                 "got %s", object_val);
@@ -2000,7 +2010,7 @@
                 {
                     asName a = pool_name(mStream->read_V32(), mPoolObject);
                     _stack.drop(completeName(a));
-                    as_object* obj = _stack.top(0).to_object().get();
+                    as_object* obj = _stack.top(0).to_object(*_global).get();
 
                     if (!obj) {
                         // TODO: what here?
@@ -2029,7 +2039,7 @@
                 {
                     as_value val;
                     boost::uint32_t sindex = mStream->read_V32();
-                    as_object* object = pop_stack().to_object().get();
+                    as_object* object = pop_stack().to_object(*_global).get();
                     if (!object) {
                         log_abc("GETSLOT: Did not find expected object on "
                                 "stack");
@@ -2061,7 +2071,7 @@
                     log_abc("SETSLOT object: %s, value: %s, index: %s",
                             object, value, sindex);
 
-                    as_object* obj = object.to_object().get();
+                    as_object* obj = object.to_object(*_global).get();
                     if ( ! obj )
                     {
                         IF_VERBOSE_ASCODING_ERRORS(
@@ -2207,7 +2217,7 @@
                 /// Do: If obj is Undefined or Null, throw TypeError
                 case SWF::ABC_ACTION_CONVERT_O:
                 {
-                    _stack.top(0) = _stack.top(0).to_object().get();
+                    _stack.top(0) = _stack.top(0).to_object(*_global).get();
                     if (_stack.top(0).is_undefined() || 
_stack.top(0).is_null())
                         throw ASTypeError();
                     break;
@@ -2222,7 +2232,7 @@
                 case SWF::ABC_ACTION_CHECKFILTER:
                 {
                     if (!_stack.top(0).is_object() ||
-                            !_stack.top(0).to_object()->isXML())
+                            !_stack.top(0).to_object(*_global)->isXML())
                         throw ASTypeError();
                     break;
                 }
@@ -2324,7 +2334,7 @@
                 case SWF::ABC_ACTION_COERCE_O:
                 {
                     if (_stack.top(0).is_undefined())
-                        _stack.top(0) = _stack.top(0).to_object().get();
+                        _stack.top(0) = 
_stack.top(0).to_object(*_global).get();
                     else
                         _stack.top(0).set_undefined();
                     break;
@@ -2673,8 +2683,8 @@
                 {
                     as_value type = pop_stack();
                     as_value value = pop_stack();
-                    as_object* const valueObject = value.to_object().get();
-                    as_object* const typeObject = type.to_object().get();
+                    as_object* const valueObject = 
value.to_object(*_global).get();
+                    as_object* const typeObject = 
type.to_object(*_global).get();
 
                     if (!valueObject || !typeObject) {
                         // TODO: what here!?
@@ -2701,7 +2711,7 @@
                 case SWF::ABC_ACTION_IN:
                 {
                     log_unimpl("ABC_ACTION_IN");
-                    //TODO: 
_stack.top(1).set_bool(_stack.top(1).to_object().contains(_stack.top(0)));
+                    //TODO: 
_stack.top(1).set_bool(_stack.top(1).to_object(*_global).contains(_stack.top(0)));
                     _stack.drop(1);
                     break;
                 }
@@ -2938,8 +2948,8 @@
        if (name.isRuntime())
        {
                as_value obj = _stack.top(offset);
-               if (obj.is_object() && obj.to_object()->isQName()) {
-                       name.fill(obj.to_object().get());
+               if (obj.is_object() && obj.to_object(*_global)->isQName()) {
+                       name.fill(obj.to_object(*_global).get());
             ++size;
         }
 
@@ -2961,7 +2971,7 @@
        if (v.is_undefined() || v.is_null()) return NULL;
 
        if (v.is_object()) {
-               asClass *pProto = NULL; // TODO: v.to_object()->getClass();
+               asClass *pProto = NULL; // TODO: 
v.to_object(*_global)->getClass();
                return pProto ? pProto->getSuper() : NULL;
        }
 

=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h      2009-07-14 07:23:01 +0000
+++ b/libcore/vm/Machine.h      2009-07-14 15:33:46 +0000
@@ -306,13 +306,7 @@
                return value;
        }
 
-       void push_scope_stack(as_value object){
-               boost::intrusive_ptr<as_object> scopeObj = object.to_object();
-               assert(scopeObj.get());
-               log_abc("Pushing value %s onto scope stack.", object);
-               _scopeStack.push(scopeObj);
-               print_scope_stack();
-       }
+       void push_scope_stack(as_value object);
 
        boost::intrusive_ptr<as_object> pop_scope_stack() {
                log_abc("Popping value %s off the scope stack.  There will be "

=== modified file 'libcore/vm/fn_call.h'
--- a/libcore/vm/fn_call.h      2009-07-14 06:01:56 +0000
+++ b/libcore/vm/fn_call.h      2009-07-14 15:33:46 +0000
@@ -242,6 +242,12 @@
     return fn.getVM();
 }
 
+inline Global_as*
+getGlobal(const fn_call& fn)
+{
+    return fn.getVM().getGlobal();
+}
+
 } // namespace gnash
 
 

=== modified file 'testsuite/libcore.all/AsValueTest.cpp'
--- a/testsuite/libcore.all/AsValueTest.cpp     2009-07-13 09:04:26 +0000
+++ b/testsuite/libcore.all/AsValueTest.cpp     2009-07-14 16:15:13 +0000
@@ -33,6 +33,7 @@
 #include "buffer.h"
 #include "network.h"
 #include "amf.h"
+#include "Global_as.h"
 #include "element.h"
 #include "GnashNumeric.h"
 #include "movie_root.h"
@@ -57,7 +58,7 @@
 
 // Prototypes for test cases
 static void test_el();
-static void test_obj();
+static void test_obj(as_object* o);
 static void test_isnan();
 static void test_conversion();
 
@@ -123,7 +124,7 @@
     // run the tests
     test_isnan();
     test_el();
-    test_obj();
+    test_obj(root);
     test_conversion();
    
 }
@@ -244,7 +245,7 @@
 }
 
 void
-test_obj()
+test_obj(as_object* o)
 {
     // Create an object element with some properties
     bool notest = false;
@@ -276,7 +277,7 @@
     }
 
     as_value fooas, baras;
-    boost::intrusive_ptr<as_object> ao1 = as1.to_object();
+    boost::intrusive_ptr<as_object> ao1 = as1.to_object(*getGlobal(*o));
 
     if (ao1 == 0) {
         notest= true;


reply via email to

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