Gnash 0.8.9
|
00001 // 00002 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 00003 // 2011 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 <vector> 00023 #include <cassert> 00024 #include <string> 00025 00026 #include "Function.h" 00027 #include "smart_ptr.h" 00028 00029 // Forward declarations 00030 namespace gnash { 00031 class action_buffer; 00032 class as_object; 00033 } 00034 00035 namespace gnash { 00036 00038 // 00045 class Function2 : public Function 00046 { 00047 00048 public: 00049 00050 enum DefineFunction2Flags 00051 { 00053 PRELOAD_THIS = 0x01, 00054 00056 SUPPRESS_THIS = 0x02, 00057 00059 PRELOAD_ARGUMENTS = 0x04, 00060 00062 SUPPRESS_ARGUMENTS = 0x08, 00063 00065 PRELOAD_SUPER = 0x10, 00066 00068 SUPPRESS_SUPER = 0x20, 00069 00071 PRELOAD_ROOT = 0x40, 00072 00074 PRELOAD_PARENT = 0x80, 00075 00077 PRELOAD_GLOBAL = 256 00078 }; 00079 00080 // Create a function defined in a DefineFunction2 opcode. 00081 Function2(const action_buffer& ab, as_environment& env, size_t start, 00082 const ScopeStack& with_stack); 00083 00084 virtual ~Function2() {} 00085 00087 virtual boost::uint8_t registers() const { 00088 return _registerCount; 00089 } 00090 00091 void setRegisterCount(boost::uint8_t ct) { 00092 _registerCount = ct; 00093 } 00094 00095 void setFlags(boost::uint16_t flags) { 00096 _function2Flags = flags; 00097 } 00098 00100 virtual as_value call(const fn_call& fn); 00101 00102 private: 00103 00105 boost::uint8_t _registerCount; 00106 00108 boost::uint16_t _function2Flags; 00109 00110 }; 00111 00112 00113 } // end of gnash namespace 00114 00115 #endif 00116