Gnash  0.8.11dev
Function2.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_FUNCTION2_H
20 #define GNASH_FUNCTION2_H
21 
22 #include "Function.h"
23 
24 // Forward declarations
25 namespace gnash {
26  class action_buffer;
27  class as_object;
28 }
29 
30 namespace gnash {
31 
33 //
40 class Function2 : public Function
41 {
42 
43 public:
44 
46  {
48  PRELOAD_THIS = 0x01,
49 
51  SUPPRESS_THIS = 0x02,
52 
55 
58 
60  PRELOAD_SUPER = 0x10,
61 
64 
66  PRELOAD_ROOT = 0x40,
67 
70 
73  };
74 
75  // Create a function defined in a DefineFunction2 opcode.
76  Function2(const action_buffer& ab, as_environment& env, size_t start,
77  const ScopeStack& with_stack);
78 
79  virtual ~Function2() {}
80 
82  virtual std::uint8_t registers() const {
83  return _registerCount;
84  }
85 
86  void setRegisterCount(std::uint8_t ct) {
87  _registerCount = ct;
88  }
89 
90  void setFlags(std::uint16_t flags) {
91  _function2Flags = flags;
92  }
93 
95  virtual as_value call(const fn_call& fn);
96 
97 private:
98 
100  std::uint8_t _registerCount;
101 
103  std::uint16_t _function2Flags;
104 
105 };
106 
107 
108 } // end of gnash namespace
109 
110 #endif
111 
Function2 adds extra sauce to ordinary Functions.
Definition: Function2.h:40
Bind one register to "arguments".
Definition: Function2.h:54
virtual ~Function2()
Definition: Function2.h:79
Function2(const action_buffer &ab, as_environment &env, size_t start, const ScopeStack &with_stack)
Definition: Function2.cpp:35
Definition: klash_part.cpp:330
ActionScript value type.
Definition: as_value.h:94
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
virtual as_value call(const fn_call &fn)
Dispatch.
Definition: Function2.cpp:46
A simple SWF-defined Function.
Definition: Function.h:63
DefineFunction2Flags
Definition: Function2.h:45
Provides information about timeline context.
Definition: as_environment.h:50
void setFlags(std::uint16_t flags)
Definition: Function2.h:90
std::vector< as_object * > ScopeStack
Definition: Function.h:68
No "argument" variable accessible by name.
Definition: Function2.h:57
Bind one register to "_root".
Definition: Function2.h:66
Bind one register to "_parent".
Definition: Function2.h:69
virtual std::uint8_t registers() const
Return the number of registers to allocate for this function.
Definition: Function2.h:82
A code segment.
Definition: action_buffer.h:49
Parameters/environment for builtin or user-defined functions callable from ActionScript.
Definition: fn_call.h:117
Bind one register to "_global".
Definition: Function2.h:72
No "this" variable accessible by name.
Definition: Function2.h:51
No "super" variable accessible by name.
Definition: Function2.h:63
void setRegisterCount(std::uint8_t ct)
Definition: Function2.h:86
Bind one register to "super".
Definition: Function2.h:60
Bind one register to "this".
Definition: Function2.h:48