swf_function.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
00003 // 
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 2 of the License, or
00007 // (at your option) any later version.
00008 // 
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
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" // for inheritance
00030 #include "with_stack_entry.h" // for composition (vector element)
00031 
00032 #include <cassert>
00033 #include <string>
00034 
00035 // Forward declarations
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         //swf_function();
00093 
00095         //
00107         //swf_function(as_object* export_iface);
00108         // USE THE builtin_function instead!
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         //void  lazy_create_properties();
00144 };
00145 
00146 
00147 } // end of gnash namespace
00148 
00149 // __GNASH_SWF_FUNCTION_H__
00150 #endif
00151 

Generated on Thu Nov 23 22:31:31 2006 for Gnash by  doxygen 1.4.6