]> git.buserror.net Git - polintos/scott/priv.git/blobdiff - idlcomp/idlc.h
parser: remove unnecessary retains
[polintos/scott/priv.git] / idlcomp / idlc.h
index 783940a822f3f5a181e5b075aba48a0fc49da105..e030bbe52ba5dc355b0068c2f9bb5293c249c5e4 100644 (file)
@@ -3,23 +3,15 @@
 //
 // This software is copyright (c) 2006 Scott Wood <scott@buserror.net>.
 // 
-// Permission is hereby granted, free of charge, to any person obtaining a copy of
-// this software and associated documentation files (the "Software"), to deal with
-// the Software without restriction, including without limitation the rights to
-// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-// of the Software, and to permit persons to whom the Software is furnished to do
-// so, subject to the following condition:
+// This software is provided 'as-is', without any express or implied warranty.
+// In no event will the authors or contributors be held liable for any damages
+// arising from the use of this software.
 // 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-// SOFTWARE.
+// Permission is hereby granted to everyone, free of charge, to use, copy,
+// modify, prepare derivative works of, publish, distribute, perform,
+// sublicense, and/or sell copies of the Software, provided that the above
+// copyright notice and disclaimer of warranty be included in all copies or
+// substantial portions of this software.
 
 #ifndef IDLC_H
 #define IDLC_H
@@ -51,7 +43,7 @@ using std::vector;
 int yylex();
 int idl_lex();
 #define cdl_lex idl_lex
-void idl_error(char *s);
+void idl_error(const char *s);
 
 #define cdl_error idl_error
 
@@ -464,6 +456,14 @@ extern int traversal;
 class Symbol : public RefCountable<Symbol> {
        NameSpace *ns;
        
+       void init()
+       {
+               ns = NULL;
+               external = false;
+               priv = false;
+               lang_priv = NULL;
+       }
+       
 public:
        StringRef name;
 
@@ -478,19 +478,12 @@ public:
        
        bool priv;
        
-       // This is set to ::traversal when this symbol is visited along a chain.
-       // If a target needs more than 8 simultaneous chains, increase the size
-       // of the array.  These traversals are reserved for language binding use.
-       
-       int traversed[8];
+       // Reserved for language binding use.
+       Releasable *lang_priv;
 
        Symbol()
        {
-               ns = NULL;
-               external = false;
-               priv = false;
-               
-               memset(traversed, 0, sizeof(traversed));
+               init();
        }
        
        Symbol(const String *_name) : name(_name)
@@ -498,11 +491,7 @@ public:
                if (_name)
                        name->retain();
 
-               ns = NULL;
-               external = false;
-               priv = false;
-
-               memset(traversed, 0, sizeof(traversed));
+               init();
        }
 
        virtual ~Symbol();
@@ -1300,6 +1289,9 @@ class Struct : public NameSpace, public Type, public Def {
        SymbolRef supersym;
        StrListRef supername;
        bool attrs_resolved;
+
+       // 0 = unknown, 1 = yes, 2 = no
+       int plain_data;
        
        void add_elem(Datum *d);
 
@@ -1473,6 +1465,10 @@ public:
                def.guid[0] = guid[0];
                def.guid[1] = guid[1];
        }
+
+       // A struct is "plain data" if it contains no object references,
+       // no non-inline arrays or structs, and no inline non-plain structs.
+       bool is_plain_data();
 };
 
 class Param : public Symbol, public Def {