gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/parser/abc_block.h serve...


From: Chad Musick
Subject: [Gnash-commit] gnash ChangeLog server/parser/abc_block.h serve...
Date: Thu, 20 Sep 2007 17:07:21 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Chad Musick <cmusick>   07/09/20 17:07:21

Modified files:
        .              : ChangeLog 
Added files:
        server/parser  : abc_block.h abc_block.cpp Namespace.h 

Log message:
        Initial files for parsing AS3 code.  This is unfinished code, I just 
want
        the safety of having it in the repository.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4362&r2=1.4363
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/abc_block.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/abc_block.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/Namespace.h?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4362
retrieving revision 1.4363
diff -u -b -r1.4362 -r1.4363
--- ChangeLog   20 Sep 2007 15:44:40 -0000      1.4362
+++ ChangeLog   20 Sep 2007 17:07:20 -0000      1.4363
@@ -1,3 +1,8 @@
+2007-09-21 Chad Musick <address@hidden>
+
+       * server/parser/abc_block.cpp,.h: Read AS3 blocks. (unfinished)
+       * server/parser/Namespace.h: AS3 namespaces (unfinished)
+
 2007-09-20 Sandro Santilli <address@hidden>
 
        * server/edit_text_character.cpp (set_variable_name): create

Index: server/parser/abc_block.h
===================================================================
RCS file: server/parser/abc_block.h
diff -N server/parser/abc_block.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/parser/abc_block.h   20 Sep 2007 17:07:21 -0000      1.1
@@ -0,0 +1,177 @@
+// 
+//   Copyright (C) 2007 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// The AS3 abc block format reader.
+//
+
+#ifndef GNASH_ABC_BLOCK_H
+#define GNASH_ABC_BLOCK_H
+
+#include <vector>
+#include <string>
+
+#include "gnash.h"
+#include "stream.h"
+#include "string_table.h"
+
+#include "Namespace.h"
+
+namespace gnash {
+
+typedef std::vector<Namespace *> abcNamespaceSet;
+
+class abc_block;
+
+namespace abc_parsing {
+
+class abc_Trait;
+
+class abc_Multiname
+{
+public:
+    typedef enum
+    {
+               KIND_Qname = 0x07,
+               KIND_QnameA = 0x0D,
+               KIND_RTQname = 0x0F,
+               KIND_RTQnameA = 0x10,
+               KIND_RTQnameL = 0x11,
+               KIND_RTQnameLA = 0x12,
+               KIND_Multiname = 0x09,
+               KIND_MultinameA = 0x0E,
+               KIND_MultinameL = 0x1B,
+               KIND_MultinameLA = 0x1C
+       } kinds;
+
+       kinds mKind;
+       string_table::key mName;
+       Namespace* mNamespace;
+       std::vector<Namespace*> *mNamespaceSet;
+};
+
+class abc_Method
+{
+public:
+       typedef enum
+       {
+               FLAG_ARGS = 0x01,
+               FLAG_ACTIVATION = 0x02,
+               FLAG_MORE = 0x04,
+               FLAG_OPTIONAL = 0x08,
+               FLAG_IGNORE = 0x10,
+               FLAG_NATIVE = 0x20,
+               FLAG_DEFAULT_NS = 0x40,
+               FLAG_PARAM_NAMES = 0x80
+       } flags;
+
+       class optional_parameter
+       {
+       public:
+               uint32_t mIndex;
+               uint8_t mKind;
+       };
+
+       abc_Multiname *mReturnType;
+       std::vector<abc_Multiname*> mParameters; // The types, not the names.
+       uint8_t mFlags;
+       std::vector<optional_parameter> mOptionalParameters;
+
+};
+
+class abc_Instance
+{
+public:
+       typedef enum
+       {
+               FLAG_SEALED = 0x01,
+               FLAG_FINAL = 0x02,
+               FLAG_INTERFACE = 0x04,
+               FLAG_PROTECTED_NS = 0x08,
+               FLAG_DYNAMIC = 0x00 // No other flags set
+       } flags;
+
+       abc_Multiname *mName;
+       abc_Multiname *mSuperType;
+       flags mFlags;
+       Namespace *mProtectedNamespace;
+       std::vector<abc_Multiname*> mInterfaces;
+       abc_Method *mMethod;
+       std::vector<abc_Trait> mTraits;
+};
+
+class abc_Trait
+{
+public:
+       typedef enum
+       {
+               KIND_SLOT = 0,
+               KIND_CONST = 6,
+               KIND_METHOD = 1,
+               KIND_GETTER = 2,
+               KIND_SETTER = 3,
+               KIND_CLASS = 4,
+               KIND_FUNCTION = 5
+       } kinds;
+
+       kinds mKind;
+       uint32_t mNameIndex;
+       uint32_t mNamespaceIndex;
+       uint32_t mNamespaceSetIndex;
+       uint32_t mSlotId;
+       uint32_t mTypeIndex;
+       uint32_t mValueIndex;
+       uint8_t mValueIndexTypeIndex;
+       uint32_t mClassInfoIndex;
+       uint32_t mMethodInfoIndex;
+
+       bool read(stream* in);
+};
+
+}; // namespace abc_parsing
+
+typedef std::vector<Namespace*> NamespaceSet;
+                       
+class abc_block
+{
+private:
+       std::vector<int32_t> mIntegerPool;
+       std::vector<uint32_t> mUIntegerPool;
+       std::vector<long double> mDoublePool;
+       std::vector<std::string> mStringPool;
+       std::vector<string_table::key> mStringPoolTableIds;
+       std::vector<Namespace> mNamespacePool;
+       std::vector<NamespaceSet> mNamespaceSetPool;
+       std::vector<abc_parsing::abc_Method> mMethods;
+       std::vector<abc_parsing::abc_Multiname> mMultinamePool;
+       std::vector<abc_parsing::abc_Instance> mInstances;
+       std::vector<uint32_t> mClasses; // TODO: Fix this.
+       std::vector<uint32_t> mScripts; // TODO: Fix this.
+       std::vector<uint32_t> mBodies; // TODO: Fix this.
+
+       string_table* mStringTable;
+
+public:
+       int32_t poolInteger(uint32_t index) const;
+       uint32_t poolUInteger(uint32_t index) const;
+       
+       bool read(stream* in);
+};
+
+}; /* namespace gnash */
+
+#endif /* GNASH_ABC_BLOCK_H */
+

Index: server/parser/abc_block.cpp
===================================================================
RCS file: server/parser/abc_block.cpp
diff -N server/parser/abc_block.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/parser/abc_block.cpp 20 Sep 2007 17:07:21 -0000      1.1
@@ -0,0 +1,478 @@
+// 
+//   Copyright (C) 2007 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// The AS3 abc block format reader.
+//
+
+#include "abc_block.h"
+#include "stream.h"
+
+namespace gnash {
+
+namespace abc_parsing {
+
+bool
+abc_Trait::read(stream* in)
+{
+       mNameIndex = in->read_V32();
+
+       uint8_t kind = in->read_u8();
+       mKind = static_cast<kinds> (kind & 0x0F);
+
+       switch (mKind)
+       {
+       case KIND_SLOT:
+       case KIND_CONST:
+       {
+               mSlotId = in->read_V32();
+               mTypeIndex = in->read_V32();
+               mValueIndex = in->read_V32();
+               mValueIndexTypeIndex = in->read_u8();
+               break;
+       }
+       case KIND_METHOD:
+       case KIND_GETTER:
+       case KIND_SETTER:
+       {
+               // Ignore the 'disp_id'
+               in->skip_V32();
+
+               mMethodInfoIndex = in->read_V32();
+               break;
+       }
+       case KIND_CLASS:
+       {
+               mSlotId = in->read_V32();
+               mClassInfoIndex = in->read_V32();
+               break;
+       }
+       case KIND_FUNCTION:
+       {
+               mSlotId = in->read_V32();
+               mMethodInfoIndex = in->read_V32();
+               break;
+       }
+       default:
+       {
+               return false;
+       }
+       } // end of switch
+
+       // Ignore the metadata, but it must be read to know how long it is.
+       if ((kind >> 4) & 0x04) // has metadata
+       {
+               uint32_t metaCount = in->read_V32();
+               for (unsigned int k = 0; k < metaCount; ++k)
+               {
+                       in->skip_V32();
+               }
+       }
+
+       return true; // Here, we were successful.
+}
+
+}; // namespace abc_parsing
+
+// Load up all of the data.
+bool
+abc_block::read(stream* in)
+{
+       using namespace abc_parsing;
+
+       std::vector<abc_Trait> traitVec;
+
+       // Minor version.
+       static_cast<void>(in->read_u16());
+       // Major version.
+       static_cast<void>(in->read_u16());
+
+       // A block of signed integers. Count overshoots by 1,
+       // and the 0 is used to signal a no-op.
+       uint32_t intPoolCount = in->read_V32();
+       mIntegerPool.resize(intPoolCount);
+       for (unsigned int i = 1; i < intPoolCount; ++i)
+       {
+               mIntegerPool[i] = in->read_s32();
+       }
+       
+       // A block of unsigned integers. Count overshoots by 1,
+       // and the 0 is used to signal a no-op.
+       uint32_t uIntPoolCount = in->read_V32();
+       mUIntegerPool.resize(uIntPoolCount);
+       for (unsigned int i = 1; i < uIntPoolCount; ++i)
+       {
+               mUIntegerPool[i] = in->read_V32();
+       }
+
+       // A block of 64 bit doubles.  Counter overshoots by 1,
+       // and the 0 is used to signal a no-op.
+       uint32_t doublePoolCount = in->read_V32();
+       mDoublePool.resize(doublePoolCount);
+       for (unsigned int i = 1; i < doublePoolCount; ++i)
+       {
+               mDoublePool[i] = in->read_d64();
+       }
+
+       // A block of strings. Counter overshoots by 1, with the 0th
+       // entry used to signal a no-op.
+       uint32_t stringPoolCount = in->read_V32();
+       mStringPool.resize(stringPoolCount);
+       for (unsigned int i = 1; i < stringPoolCount; ++i)
+       {
+               uint32_t length = in->read_V32();
+               in->read_string_with_length(length, mStringPool[i]);
+       }
+
+       // Many of the strings will correspond to string table entries --
+       // fill this up as we find these.
+       mStringPoolTableIds.resize(stringPoolCount);
+       for (unsigned int i = 0; i < stringPoolCount; ++i)
+               mStringPoolTableIds[i] = 0;
+
+       // These are namespaces, individually. The counter overshoots by
+       // 1, with the 0th entry used to signal a wildcard.
+       uint32_t namespacePoolCount = in->read_V32();
+       mNamespacePool.resize(namespacePoolCount);
+       mNamespacePool[0].mUri = mNamespacePool[0].mPrefix = 0;
+       mNamespacePool[0].mKind = Namespace::KIND_NORMAL;
+       for (unsigned int i = 1; i < namespacePoolCount; ++i)
+       {
+               uint8_t kind = in->read_u8();
+               if (kind == Namespace::KIND_PACKAGE)
+                       kind = Namespace::KIND_NORMAL;
+               else
+                       kind = static_cast<Namespace::kinds> (kind);
+               // All namespaces have the same structure, though the usage 
differs.
+
+               uint32_t nameIndex = in->read_V32();
+               // Set the name of the namespace.
+               if (nameIndex && nameIndex < mStringPool.size())
+               {
+                       // If we don't have an index for this yet, do so now.
+                       if (mStringPoolTableIds[nameIndex] == 0)
+                               mStringPoolTableIds[nameIndex] =
+                                       
mStringTable->find(mStringPool[nameIndex]);
+                       // And reset the nameIndex for the uri.
+                       nameIndex = mStringPoolTableIds[nameIndex];
+               }
+               else
+                       nameIndex = 0;
+               // And set the name in the Namespace itself.
+               mNamespacePool[i].mUri = nameIndex;
+               // The prefix is unknown right now.
+               mNamespacePool[i].mPrefix = 0;
+       }
+
+       // These are sets of namespaces, which use the individual ones above.
+       uint32_t namespaceSetPoolCount = in->read_V32();
+       mNamespaceSetPool.resize(namespaceSetPoolCount);
+       // The base namespace set is empty.
+       mNamespaceSetPool[0].resize(0);
+       for (unsigned int i = 1; i < namespaceSetPoolCount; ++i)
+       {
+               // These counts are not inflated the way the others are.
+               uint32_t count = in->read_V32();
+               mNamespaceSetPool[i].resize(count);
+               for (unsigned int j = 0; j < count; ++j)
+               {
+                       uint32_t selection = in->read_V32();
+                       if (!selection || selection >= namespacePoolCount)
+                       {
+                               // Reached a bad selection.
+                               return false;
+                       }
+                       mNamespaceSetPool[i][j] = &mNamespacePool[selection];
+               }
+       }
+
+       // A list of the multinames. The counter overestimates by 1, and the
+       // 0th is used as a no-op.
+       uint32_t multinamePoolCount = in->read_V32();
+       mMultinamePool.resize(multinamePoolCount);
+       for (unsigned int i = 0; i < multinamePoolCount; ++i)
+       {
+               uint8_t kind = in->read_u8();
+               mMultinamePool[i].mKind = 
static_cast<abc_Multiname::kinds>(kind);
+               uint32_t ns = 0;
+               uint32_t name = 0;
+               uint32_t nsset = 0;
+
+               // Read, but don't upper validate until after the switch
+               switch (kind)
+               {
+               case abc_Multiname::KIND_Qname:
+               case abc_Multiname::KIND_QnameA:
+               {
+                       ns = in->read_V32();
+                       name = in->read_V32();
+                       break;
+               }
+               case abc_Multiname::KIND_RTQname:
+               case abc_Multiname::KIND_RTQnameA:
+               {
+                       name = in->read_V32();
+                       break;
+               }
+               case abc_Multiname::KIND_RTQnameL:
+               case abc_Multiname::KIND_RTQnameLA:
+               {
+                       break;
+               }
+               case abc_Multiname::KIND_Multiname:
+               case abc_Multiname::KIND_MultinameA:
+               {
+                       name = in->read_V32();
+                       nsset = in->read_V32();
+                       // 0 is not a valid nsset.
+                       if (!nsset)
+                               return false;
+                       break;
+               }
+               case abc_Multiname::KIND_MultinameL:
+               case abc_Multiname::KIND_MultinameLA:
+               {
+                       nsset = in->read_V32();
+                       // 0 is not a valid nsset.
+                       if (!nsset)
+                               return false;
+                       break;
+               }
+               default:
+               {
+                       // Unknown type.
+                       return false;
+               } // End of cases.
+               } // End of switch.
+
+               if (name >= mStringPool.size())
+                       return false; // Bad name.
+               if (ns >= mNamespacePool.size())
+                       return false; // Bad namespace.
+               if (nsset >= mNamespaceSetPool.size())
+                       return false; // Bad namespace set.
+
+               // The name should be in the string table.
+               if (name && mStringPoolTableIds[name] == 0)
+               {
+                       mStringPoolTableIds[name] = 
mStringTable->find(mStringPool[name]);
+               }
+               mMultinamePool[i].mName = mStringPoolTableIds[name];
+
+               if (ns)
+                       mMultinamePool[i].mNamespace = &mNamespacePool[ns];
+               if (nsset)
+                       mMultinamePool[i].mNamespaceSet = 
&mNamespaceSetPool[nsset];
+
+       } // End of multiname loop.
+
+       uint32_t methodCount = in->read_V32();
+       mMethods.resize(methodCount);
+       for (unsigned int i = 0; i < methodCount; ++i)
+       {
+               abc_Method& method = mMethods[i];
+
+               uint32_t param_count = in->read_V32();
+               uint32_t return_type = in->read_V32();
+
+               if (return_type >= mMultinamePool.size())
+                       return false;
+
+               method.mReturnType = &mMultinamePool[return_type];
+
+               method.mParameters.resize(param_count);
+               for (unsigned int j = 0; j < param_count; ++j)
+               {
+                       // The parameter type.
+                       uint32_t ptype = in->read_V32();
+                       if (ptype >= mMultinamePool.size())
+                               return false;
+                       method.mParameters[j] = &mMultinamePool[ptype];
+               }
+               // We ignore the name_index
+               in->skip_V32();
+
+               uint8_t flags = in->read_u8();
+               method.mFlags = flags;
+
+               // Some parameters have default values.
+               if (flags & abc_Method::FLAG_OPTIONAL)
+               {
+                       uint32_t count = in->read_V32();
+                       method.mOptionalParameters.resize(count);
+                       for (unsigned int j = 0; j < count; ++j)
+                       {
+                               // The value index.
+                               method.mOptionalParameters[j].mIndex = 
in->read_V32();
+                               // The value kind.
+                               method.mOptionalParameters[j].mKind = 
in->read_u8();
+                       }
+               }
+
+               // The parameters are given names, which AS3 can't use. We don't
+               // either, since we're not a development environment.
+               if (flags & abc_Method::FLAG_PARAM_NAMES)
+               {
+                       for (unsigned int j = 0; j < param_count; ++j)
+                       {
+                               in->skip_V32();
+                       }
+               }
+       } // End of method loop.
+
+       // Following is MetaData, which we will ignore.
+       in->skip_V32(); // A name index.
+       uint32_t metaCount = in->read_V32();
+       for (unsigned int i = 0; i < metaCount; ++i)
+       {
+               // key and values are _not_ in this order (they group 
together), but
+               // we are just skipping anyway.
+               in->skip_V32();
+               in->skip_V32();
+       }
+
+       // Classes count.
+       uint32_t classCount = in->read_V32();
+       mClasses.resize(classCount);
+
+       // But first, instances, which uses classCount
+       mInstances.resize(classCount);
+       for (unsigned int i = 0; i < classCount; ++i)
+       {
+               abc_Instance& instance = mInstances[i];
+               uint32_t index = in->read_V32();
+               if (!index || index >= mMultinamePool.size())
+                       return false; // Name out of bounds.
+               instance.mName = &mMultinamePool[index];
+
+               uint32_t super_index = in->read_V32();
+               if (!super_index)
+                       instance.mSuperType = NULL;
+               else if (super_index >= mMultinamePool.size())
+                       return false; // Bad index.
+               else
+                       instance.mSuperType = &mMultinamePool[super_index];
+
+               uint8_t flags = in->read_u8();
+               instance.mFlags = static_cast<abc_Instance::flags> (flags);
+
+               instance.mProtectedNamespace = NULL;
+               if (flags & abc_Instance::FLAG_PROTECTED_NS) // Protected 
namespace
+               {
+                       uint32_t ns_index = in->read_V32();
+                       if (ns_index >= mNamespacePool.size())
+                               return false;
+                       if (ns_index)
+                               instance.mProtectedNamespace = 
&mNamespacePool[ns_index];
+               }
+
+               // Get the interfaces.
+               uint32_t interfaceCount = in->read_V32();
+               instance.mInterfaces.resize(interfaceCount);
+               for (unsigned int j = 0; j < interfaceCount; ++j)
+               {
+                       uint32_t i_index = in->read_V32();
+                       if (!i_index || i_index >= mMultinamePool.size())
+                               return false; // Bad read.
+                       instance.mInterfaces[j] = &mMultinamePool[i_index];
+               }
+
+               // Reach into the methods list.
+               uint32_t methodsOffset = in->read_V32();
+               if (methodsOffset >= mMethods.size())
+                       return false; // Bad method.
+               instance.mMethod = &mMethods[methodsOffset];
+
+               // Now parse the traits.
+               // How many of them.
+               uint32_t traitsCount = in->read_V32();
+               instance.mTraits.resize(traitsCount);
+               for (unsigned int j = 0; j < traitsCount; ++j)
+               {
+                       instance.mTraits[j].read(in);
+               }
+       } // end of instances list
+
+       // Now the classes are read. TODO: Discover what these do.
+       for (unsigned int i = 0; i < classCount; ++i)
+       {
+               uint32_t initial_method_offset = in->read_V32();
+               uint32_t traitsCount = in->read_V32();
+               traitVec.resize(traitsCount);
+               for (unsigned int j = 0; j < traitsCount; ++j)
+               {
+                       traitVec[j].read(in);
+               }
+       } // end of classes list
+
+       // The scripts. TODO: Discover what these do.
+       uint32_t scriptCount = in->read_V32();
+       mScripts.resize(scriptCount);
+       for (unsigned int i = 0; i < scriptCount; ++i)
+       {
+               uint32_t initial_method_offset = in->read_V32();
+               uint32_t traitsCount = in->read_V32();
+               traitVec.resize(traitsCount);
+               for (unsigned int j = 0; j < traitsCount; ++j)
+               {
+                       traitVec[j].read(in);
+               }
+       }
+
+       // The method bodies. TODO: Use these.
+       uint32_t methodBodyCount = in->read_V32();
+       for (unsigned int i = 0; i < methodBodyCount; ++i)
+       {
+               uint32_t method_info = in->read_V32();
+               // We don't care about the maximum stack size. Discard it.
+               in->skip_V32();
+               // We don't care about the maximum register size. Discard it.
+               in->skip_V32();
+               // What to do with the scope depth?
+               in->skip_V32();
+               // What to do with the max scope depth?
+               in->skip_V32();
+               // How long is the code?
+               uint32_t code_length = in->read_V32();
+               // And the code:
+               // TODO: Grab code_length bytes for the code.
+               uint32_t exceptions_count = in->read_V32();
+               for (unsigned int j = 0; j < exceptions_count; ++j)
+               {
+                       // Where the try block ? begins and ends.
+                       uint32_t start_offset = in->read_V32();
+                       uint32_t end_offset = in->read_V32();
+                       // Where the catch block is located.
+                       uint32_t catch_offset = in->read_V32();
+                       // What types should be caught.
+                       uint32_t catch_type = in->read_V32();
+                       // If caught, what is the variable name.
+                       uint32_t catch_var_name = in->read_V32();
+               }
+               uint32_t traitsCount = in->read_V32();
+               traitVec.resize(traitsCount);
+               for (unsigned int j = 0; j < traitsCount; ++j)
+               {
+                       traitVec[j].read(in);
+               }
+       }
+
+       // If flow reaches here, everything went fine.
+       return true;
+}
+
+}; /* namespace gnash */
+

Index: server/parser/Namespace.h
===================================================================
RCS file: server/parser/Namespace.h
diff -N server/parser/Namespace.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/parser/Namespace.h   20 Sep 2007 17:07:21 -0000      1.1
@@ -0,0 +1,69 @@
+// 
+//   Copyright (C) 2007 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// 
+//
+
+#ifndef GNASH_NAMESPACE_H
+#define GNASH_NAMESPACE_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "string_table.h"
+
+namespace gnash {
+
+class abc_block;
+
+class Namespace
+{
+public:
+       friend class abc_block; // Parser for abc_blocks.
+
+       typedef enum
+       {
+               KIND_NORMAL = 0x08,
+               KIND_PRIVATE = 0x05,
+               KIND_PACKAGE = 0x16,
+               KIND_PACKAGE_INTERNAL = 0x17,
+               KIND_PROTECTED = 0x18,
+               KIND_EXPLICIT = 0x19,
+               KIND_STATIC_PROTECTED = 0x1A
+       } kinds;
+
+       string_table::key getUri() const { return mUri; }
+       string_table::key getPrefix() const { return mPrefix; }
+
+       Namespace(string_table::key uri, string_table::key prefix, kinds kind) :
+               mUri(uri), mPrefix(prefix), mKind(kind)
+       {/**/}
+
+       Namespace() : mUri(0), mPrefix(0), mKind(KIND_NORMAL) {/**/}
+
+       void Initialize(string_table::key uri, string_table::key prefix, kinds 
kind)
+       { mUri = uri; mPrefix = prefix; mKind = kind; }
+
+private:
+       string_table::key mUri;
+       string_table::key mPrefix;
+       kinds mKind;
+};
+
+}; /* namespace gnash */
+#endif /* GNASH_NAMESPACE_H */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]