00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _GNASH_AS_FUNCTION_H_
00019 #define _GNASH_AS_FUNCTION_H_
00020
00021 #ifdef HAVE_CONFIG_H
00022 #include "gnashconfig.h"
00023 #endif
00024
00025 #include "as_object.h"
00026
00027
00028 namespace gnash {
00029 class fn_call;
00030 class builtin_function;
00031 }
00032
00033 namespace gnash {
00034
00036
00065 class as_function : public as_object
00066 {
00067 public:
00068
00070 virtual ~as_function() {}
00071
00072
00073 as_function* to_function() { return this; }
00074
00076 virtual as_value operator()(const fn_call& fn)=0;
00077
00079 as_value call(const fn_call& fn) { return operator()(fn); }
00080
00082
00098 boost::intrusive_ptr<as_object> constructInstance( as_environment& env,
00099 unsigned nargs, unsigned first_arg_index);
00100
00103 boost::intrusive_ptr<as_object> getPrototype();
00104
00106 void extends(as_function& superclass);
00107
00109 virtual bool isBuiltin() { return false; }
00110
00113 std::string get_text_value() const
00114 {
00115 return "[type Function]";
00116 }
00117
00119 static boost::intrusive_ptr<builtin_function> getFunctionConstructor();
00120
00121 #ifdef GNASH_USE_GC
00123 //
00131 virtual void markReachableResources() const
00132 {
00133 markAsFunctionReachable();
00134 }
00135 #endif // GNASH_USE_GC
00136
00137 protected:
00138
00139 #ifdef GNASH_USE_GC
00142 //
00146 void markAsFunctionReachable() const
00147 {
00148
00149
00150 markAsObjectReachable();
00151 }
00152 #endif // GNASH_USE_GC
00153
00155
00159 as_function();
00160
00162
00170 as_function(as_object* iface);
00171
00173
00178
00179
00180 private:
00181
00182 void setPrototype(as_object* proto);
00183 };
00184
00186 void function_class_init(as_object& global);
00187
00188
00189 as_value function_apply(const fn_call& fn);
00190 as_value function_call(const fn_call& fn);
00191
00192
00193 }
00194
00195
00196 #endif
00197