00001 // 00002 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software 00003 // 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 00022 // 00045 #ifndef GNASH_GLOBALS_H 00046 #define GNASH_GLOBALS_H 00047 00048 #include <string> 00049 #include "Global_as.h" 00050 #include "extension.h" 00051 #include "ClassHierarchy.h" 00052 00053 // Forward declarations 00054 namespace gnash { 00055 namespace abc { 00056 class Machine; 00057 } 00058 class VM; 00059 class fn_call; 00060 } 00061 00062 namespace gnash { 00063 00064 class AVM1Global : public Global_as 00065 { 00066 public: 00067 00068 AVM1Global(VM& vm); 00069 ~AVM1Global() {} 00070 00071 void registerClasses(); 00072 00073 virtual as_object* createString(const std::string& s); 00074 00075 virtual as_object* createNumber(double d); 00076 00077 virtual as_object* createBoolean(bool b); 00078 00079 virtual as_object* createObject(); 00080 00081 virtual as_object* createArray(); 00082 00083 virtual const ClassHierarchy& classHierarchy() const { 00084 return _classes; 00085 } 00086 00087 virtual ClassHierarchy& classHierarchy() { 00088 return _classes; 00089 } 00090 00091 virtual VM& getVM() const { 00092 return vm(); 00093 } 00094 00096 virtual builtin_function* createFunction(Global_as::ASFunction function); 00097 00099 // 00102 virtual as_object* createClass(Global_as::ASFunction ctor, 00103 as_object* prototype); 00104 00105 protected: 00106 00107 virtual void markReachableResources() const; 00108 00109 private: 00110 00111 void loadExtensions(); 00112 Extension _et; 00113 00114 ClassHierarchy _classes; 00115 00116 as_object* _objectProto; 00117 00118 }; 00119 00120 } // namespace gnash 00121 00122 #endif