Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GNASH_SWF_DOABCTAG_H
00020 #define GNASH_SWF_DOABCTAG_H
00021
00022 #include <string>
00023 #include "ControlTag.h"
00024 #include "SWF.h"
00025 #include "MovieClip.h"
00026 #include "SWFStream.h"
00027 #include "AbcBlock.h"
00028 #include "Machine.h"
00029 #include "VM.h"
00030
00031
00032 namespace gnash {
00033 class movie_definition;
00034 }
00035
00036 namespace gnash {
00037 namespace SWF {
00038
00040
00042 class DoABCTag : public ControlTag
00043 {
00044 public:
00045
00046 virtual void executeActions(MovieClip* m, DisplayList& ) const
00047 {
00048
00049 if (!_abc) {
00050 log_debug("Not executing ABC tag because we failed to parse it");
00051 return;
00052 }
00053
00054 VM& vm = getVM(*getObject(m));
00055
00056 log_debug("getting machine.");
00057 abc::Machine *mach = vm.getMachine();
00058
00059 _abc->prepare(mach);
00060
00061 log_debug("Begin execute AbcBlock.");
00062 mach->initMachine(_abc);
00063 log_debug("Executing machine...");
00064 mach->execute();
00065 }
00066
00067 void read(SWFStream* )
00068 {
00069 }
00070
00071 static void loader(SWFStream& in, TagType tag, movie_definition& m,
00072 const gnash::RunResources&)
00073 {
00074
00075 if (!m.isAS3()) {
00076 IF_VERBOSE_MALFORMED_SWF(
00077 log_swferror("SWF contains ABC tag, but is not an "
00078 "AS3 SWF!");
00079 );
00080 throw ParserException("ABC tag found in non-AS3 SWF!");
00081 }
00082
00083 if (tag == SWF::DOABCDEFINE) {
00084 in.ensureBytes(4);
00085 static_cast<void> (in.read_u32());
00086 std::string name;
00087 in.read_string(name);
00088 }
00089
00090 std::auto_ptr<abc::AbcBlock> block(new abc::AbcBlock());
00091 if (!block->read(in)) {
00092 log_error("ABC parsing error while processing DoABCTag. This "
00093 "tag will never be executed");
00094 return;
00095 }
00096
00097
00098 boost::intrusive_ptr<DoABCTag> ABCtag(new DoABCTag(block.release()));
00099
00100 IF_VERBOSE_PARSE (
00101 log_parse(_("tag %d: DoABCDefine"), tag);
00102 log_parse(_("-- actions in frame %d"), m.get_loading_frame());
00103 );
00104
00105 m.addControlTag(ABCtag);
00106 }
00107
00108 private:
00109
00110 DoABCTag(abc::AbcBlock* block) : _abc(block) {}
00111
00112 abc::AbcBlock* _abc;
00113
00114 };
00115
00116 }
00117 }
00118
00119
00120 #endif // GNASH_SWF_DOABCTAG_H
00121
00122
00123
00124
00125
00126