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