Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GNASH_BUILTIN_FUNCTION_H
00020 #define GNASH_BUILTIN_FUNCTION_H
00021
00022 #include "UserFunction.h"
00023 #include "fn_call.h"
00024
00025 #include <cassert>
00026
00027 namespace gnash {
00028
00029
00031
00035
00038 class builtin_function : public UserFunction
00039 {
00040 typedef as_value (*ASFunction)(const fn_call& fn);
00041
00042 public:
00043
00045
00051 builtin_function(Global_as& gl, ASFunction func)
00052 :
00053 UserFunction(gl),
00054 _func(func)
00055 {
00056 }
00057
00059
00061 virtual boost::uint8_t registers() const {
00062 return 0;
00063 }
00064
00066 virtual as_value call(const fn_call& fn)
00067 {
00068 FrameGuard guard(getVM(fn), *this);
00069
00070 assert(_func);
00071 return _func(fn);
00072 }
00073
00074 bool isBuiltin() { return true; }
00075
00076 private:
00077
00078 ASFunction _func;
00079 };
00080
00081 }
00082
00083 #endif
00084