00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GNASH_SWF_FUNCTION_H__
00022 #define __GNASH_SWF_FUNCTION_H__
00023
00024 #ifdef HAVE_CONFIG_H
00025 #include "config.h"
00026 #endif
00027
00028 #include "impl.h"
00029 #include "as_function.h"
00030 #include "with_stack_entry.h"
00031
00032 #include <cassert>
00033 #include <string>
00034
00035
00036 namespace gnash {
00037 class action_buffer;
00038 class as_environmnet;
00039 }
00040
00041 namespace gnash {
00042
00044 class swf_function : public as_function
00045 {
00046
00047 private:
00048
00050 const action_buffer* m_action_buffer;
00051
00053 as_environment* m_env;
00054
00056 std::vector<with_stack_entry> m_with_stack;
00057
00061 size_t m_start_pc;
00062
00064
00068 size_t m_length;
00069
00070 struct arg_spec
00071 {
00072 int m_register;
00073 std::string m_name;
00074 };
00075 std::vector<arg_spec> m_args;
00076 bool m_is_function2;
00077 uint8 m_local_register_count;
00078
00081 uint16 m_function2_flags;
00082
00083 public:
00084
00085 ~swf_function();
00086
00088
00092
00093
00095
00107
00108
00109
00113
00119 swf_function(const action_buffer* ab,
00120 as_environment* env,
00121 size_t start,
00122 const std::vector<with_stack_entry>& with_stack);
00123
00124 void set_is_function2() { m_is_function2 = true; }
00125
00126 void set_local_register_count(uint8 ct) { assert(m_is_function2); m_local_register_count = ct; }
00127
00128 void set_function2_flags(uint16 flags) { assert(m_is_function2); m_function2_flags = flags; }
00129
00130 void add_arg(int arg_register, const char* name)
00131 {
00132 assert(arg_register == 0 || m_is_function2 == true);
00133 m_args.resize(m_args.size() + 1);
00134 m_args.back().m_register = arg_register;
00135 m_args.back().m_name = name;
00136 }
00137
00138 void set_length(int len);
00139
00141 void operator()(const fn_call& fn);
00142
00143
00144 };
00145
00146
00147 }
00148
00149
00150 #endif
00151