Gnash  0.8.10
Function2.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
00003 //   Free Software Foundation, Inc
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef GNASH_FUNCTION2_H
00020 #define GNASH_FUNCTION2_H
00021 
00022 #include "Function.h"
00023 
00024 // Forward declarations
00025 namespace gnash {
00026     class action_buffer;
00027     class as_object;
00028 }
00029 
00030 namespace gnash {
00031 
00033 //
00040 class Function2 : public Function
00041 {
00042 
00043 public:
00044 
00045         enum DefineFunction2Flags
00046         {
00048                 PRELOAD_THIS = 0x01,
00049 
00051                 SUPPRESS_THIS = 0x02,
00052 
00054                 PRELOAD_ARGUMENTS = 0x04,
00055 
00057                 SUPPRESS_ARGUMENTS = 0x08,
00058 
00060                 PRELOAD_SUPER = 0x10,
00061 
00063                 SUPPRESS_SUPER = 0x20,
00064 
00066                 PRELOAD_ROOT = 0x40, 
00067 
00069                 PRELOAD_PARENT = 0x80,
00070 
00072                 PRELOAD_GLOBAL = 256
00073         };
00074 
00075     // Create a function defined in a DefineFunction2 opcode.
00076         Function2(const action_buffer& ab, as_environment& env, size_t start,
00077                 const ScopeStack& with_stack);
00078 
00079         virtual ~Function2() {}
00080 
00082     virtual boost::uint8_t registers() const {
00083         return _registerCount;
00084     }
00085 
00086         void setRegisterCount(boost::uint8_t ct) {
00087         _registerCount = ct;
00088     }
00089 
00090         void setFlags(boost::uint16_t flags) {
00091         _function2Flags = flags;
00092     }
00093 
00095         virtual as_value call(const fn_call& fn);
00096 
00097 private:
00098 
00100         boost::uint8_t _registerCount;
00101 
00103         boost::uint16_t _function2Flags;
00104 
00105 };
00106 
00107 
00108 } // end of gnash namespace
00109 
00110 #endif
00111