+// Types which are only used when compiling CDL files
+//
+// 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:
+//
+// 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.
+
+
#ifndef CDL_H
#define CDL_H
%{
-/* cdlparse.y -- parser for the CDL compiler
- *
- * Written by Scott Wood <scott@buserror.net>
- */
+// CDL parser
+//
+// 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:
+//
+// 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.
#include <stdlib.h>
#include <string.h>
%{
-/* idlparse.y -- parser for the IDL compiler
- *
- * Written by Scott Wood <scott@buserror.net>
- */
+// IDL parser
+//
+// 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:
+//
+// 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.
#include <stdlib.h>
#include <string.h>
-/* input.cc -- Code to load symbols from a legacy filesystem
- *
- * Written by Scott Wood <scott@buserror.net>
- */
+// Code to load symbols from a legacy filesystem
+//
+// 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:
+//
+// 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.
#include <cstdio>
#include <vector>
-/* lang.h -- Definitions used with language bindings
- *
- * Written by Scott Wood <scott@buserror.net>
- */
+// Definitions used with language bindings
#ifndef IDLC_LANG_H
#define IDLC_LANG_H
-/* main.cc -- entry point for the interface compiler
- *
- * Written by Scott Wood <scott@buserror.net>
- *
- * The idlc program implements two main functions. One is to turn
- * .idl files into binary type descriptions. The other is to turn
- * those type descriptions into language-specific stubs (though a
- * compiler/interpreter could also just read the binary types
- * directly, as the ORB does).
- *
- * For the former function, it is necessary to do the work in multiple
- * passes, as not all information is available the first time through due
- * to the absence of forward declarations. The passes are as follows:
- *
- * 1: Parse the input text, and determine which symbols exist in
- * which namespaces. At this point, no non-namespace-qualified
- * symbol lookups will be done (though namespace-qualified lookups
- * are done, such as to check for duplicate symbols).
- *
- * Objects will be created for each entity (Interface, Struct,
- * Datum, Alias, etc.), but any reference to another entity will be
- * stored as a StrList, not as an object pointer. This must be the
- * case even if a lookup during this pass would have found
- * something, as on the second pass it might find a "closer"
- * matching symbol added later.
- *
- * The StrList will later be looked up with only the entity
- * containing the reference as context, so namespace search rules
- * must not depend on anything else.
- *
- * This is the only pass that involves actually reading and
- * parsing the input file(s).
- *
- * 2: Look up the namespace names of using namespace.* statements.
- * These are the only lookups where order of the statements in the
- * file matters, and it alters the result of a lookup, so it must be
- * completed before chain lookups are done.
- *
- * 3: Look up the symbol names recorded in pass 1 for aliases, and
- * typedefs, and const datum initializers and types. This is done
- * before the rest of the lookups, so there will always be a
- * complete chain to follow in subsequent passes.
- *
- * This is done by calling the virtual lookup_chain() method on
- * the root namespace, which recursively calls it on all of its
- * contents.
- *
- * 4: Look up other symbol names recorded in pass 1. At this point,
- * unresolved alias chains may still exist and must be handled,
- * though they should be fixed during this phase so that they do not
- * appear in phase 4. Typedefs will remain fully chained, as the
- * chain is semantically meaningful and must be preserved in the
- * output.
- *
- * Const datum initializers are looked up in this pass despite being
- * chains, since aliases aren't resolved in pass 2, and it's
- * (slightly) easier to do the lookup in pass 3 and resolve the
- * chain in pass 4 than to store a Symbol reference in pass 2,
- * get the concerete sym in pass 3, and still have to either
- * concrete-ize other Datums' initializers or wait until pass 4
- * to resolve the chain.
- *
- * This is done by calling the virtual lookup_misc() method on the
- * root namespace, which recursively calls it on all of its
- * contents. Upon receiving this call, each entity object should
- * call lookup_sym() or lookup_type() on the various StrLists it has
- * stored, but should not do anything with the object pointer
- * until pass 4 (unless the object was satisfactorily initialized
- * in pass 1).
- *
- * 5: Perform any remaining semantic analysis, now that all references
- * to other entities have been looked up.
- *
- * This is done by calling the virtual final_analysis() method on
- * the root namespace, which recursively calls it on all of its
- * contents.
- *
- * 6: Generate output.
- * This is done by calling the virtual output() method on
- * the root namespace, which recursively calls it on all of its
- * contents.
- *
- * All circular dependencies must be contained within the set of files
- * passed to the compiler in one invocation. Supporting circular
- * dependencies over multiple invocations of the compiler would require
- * explicitly running only certain passes, then compiling the other
- * batch, and then finishing the original batch. It could be done with
- * some pain (intermediate states would need to be serialized), but I
- * only want to do it if there's a real need. Circular dependencies
- * ought to be isolated fairly locally...
- */
+// Entry point for the interface compiler
+//
+// 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:
+//
+// 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.
+//
+// The idlc program implements two main functions. One is to turn
+// .idl files into binary type descriptions. The other is to turn
+// those type descriptions into language-specific stubs (though a
+// compiler/interpreter could also just read the binary types
+// directly, as the ORB does).
+//
+// For the former function, it is necessary to do the work in multiple
+// passes, as not all information is available the first time through due
+// to the absence of forward declarations. The passes are as follows:
+//
+// 1: Parse the input text, and determine which symbols exist in
+// which namespaces. At this point, no non-namespace-qualified
+// symbol lookups will be done (though namespace-qualified lookups
+// are done, such as to check for duplicate symbols).
+//
+// Objects will be created for each entity (Interface, Struct,
+// Datum, Alias, etc.), but any reference to another entity will be
+// stored as a StrList, not as an object pointer. This must be the
+// case even if a lookup during this pass would have found
+// something, as on the second pass it might find a "closer"
+// matching symbol added later.
+//
+// The StrList will later be looked up with only the entity
+// containing the reference as context, so namespace search rules
+// must not depend on anything else.
+//
+// This is the only pass that involves actually reading and
+// parsing the input file(s).
+//
+// 2: Look up the namespace names of using namespace.* statements.
+// These are the only lookups where order of the statements in the
+// file matters, and it alters the result of a lookup, so it must be
+// completed before chain lookups are done.
+//
+// 3: Look up the symbol names recorded in pass 1 for aliases, and
+// typedefs, and const datum initializers and types. This is done
+// before the rest of the lookups, so there will always be a
+// complete chain to follow in subsequent passes.
+//
+// This is done by calling the virtual lookup_chain() method on
+// the root namespace, which recursively calls it on all of its
+// contents.
+//
+// 4: Look up other symbol names recorded in pass 1. At this point,
+// unresolved alias chains may still exist and must be handled,
+// though they should be fixed during this phase so that they do not
+// appear in phase 4. Typedefs will remain fully chained, as the
+// chain is semantically meaningful and must be preserved in the
+// output.
+//
+// Const datum initializers are looked up in this pass despite being
+// chains, since aliases aren't resolved in pass 2, and it's
+// (slightly) easier to do the lookup in pass 3 and resolve the
+// chain in pass 4 than to store a Symbol reference in pass 2,
+// get the concerete sym in pass 3, and still have to either
+// concrete-ize other Datums' initializers or wait until pass 4
+// to resolve the chain.
+//
+// This is done by calling the virtual lookup_misc() method on the
+// root namespace, which recursively calls it on all of its
+// contents. Upon receiving this call, each entity object should
+// call lookup_sym() or lookup_type() on the various StrLists it has
+// stored, but should not do anything with the object pointer
+// until pass 4 (unless the object was satisfactorily initialized
+// in pass 1).
+//
+// 5: Perform any remaining semantic analysis, now that all references
+// to other entities have been looked up.
+//
+// This is done by calling the virtual final_analysis() method on
+// the root namespace, which recursively calls it on all of its
+// contents.
+//
+// 6: Generate output.
+// This is done by calling the virtual output() method on
+// the root namespace, which recursively calls it on all of its
+// contents.
+//
+// All circular dependencies must be contained within the set of files
+// passed to the compiler in one invocation. Supporting circular
+// dependencies over multiple invocations of the compiler would require
+// explicitly running only certain passes, then compiling the other
+// batch, and then finishing the original batch. It could be done with
+// some pain (intermediate states would need to be serialized), but I
+// only want to do it if there's a real need. Circular dependencies
+// ought to be isolated fairly locally...
#include <climits>
#include <cstdio>
-/* namespace.cc -- Code to maintain and search namespaces
- *
- * Written by Scott Wood <scott@buserror.net>
- */
+// Code to maintain and search namespaces
+//
+// 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:
+//
+// 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.
#include <idlc.h>
#include <parser.h>
-/* output.cc -- Code to output symbols to a legacy filesystem
- *
- * Written by Scott Wood <scott@buserror.net>
- */
+// Code to output symbols to a legacy filesystem
+//
+// 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:
+//
+// 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.
#include <cstring>
#include <cerrno>
%{
-/* scan.lex -- scanner for the IDL compiler
- *
- * Written by Scott Wood <scott@buserror.net>
- */
+// IDL/CDL scanner
+//
+// 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:
+//
+// 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.
#include <idlc.h>
#include <parser.h>
-/* targets.h -- target architecture definitions
- *
- * Written by Scott Wood <scott@buserror.net>
- */
+// Target architecture definitions
#ifndef IDLC_TARGETS_H
#define IDLC_TARGETS_H
-/* types.cc -- Semantic actions for types and namespaces.
- *
- * Written by Scott Wood <scott@buserror.net>
- */
+// Semantic actions for types and namespaces
+//
+// 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:
+//
+// 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.
#include <cfloat>
#include <sstream>