02fa6a31e6
* generator/*.cs : Move into GtkSharp.Generation namespace. * generator/CodeGenerator.cs (Main): Add usage check. Add SymbolTable. * generator/EnumGen.cs (QualifiedName): New. (Generate): Add SymbolTable to signature. * generator/IGeneratable : Add QualifiedName prop and update Generate signature. * generator/Parser.cs : Switch from plain Hashtable to SymbolTable. (Parse): Replaces the Types property and returns a SymbolTable. * generator/StructBase.cs : New base class to derive struct and object types. Initial implementation of protected GenField method and ctor. * generator/StructGen.cs : New non-object struct type generatable. * generator/SymbolTable.cs : New. Manages complex types hash and a simple types hash. Will provide generic lookup interface. svn path=/trunk/gtk-sharp/; revision=1855
36 lines
780 B
C#
36 lines
780 B
C#
// GtkSharp.Generation.CodeGenerator.cs - The main code generation engine.
|
|
//
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2001 Mike Kestner
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Xml;
|
|
|
|
public class CodeGenerator {
|
|
|
|
public static int Main (string[] args)
|
|
{
|
|
if (args.Length != 1) {
|
|
Console.WriteLine ("Usage: codegen <filename>");
|
|
return 0;
|
|
}
|
|
|
|
Parser p = new Parser (args[0]);
|
|
SymbolTable table = p.Parse ();
|
|
Console.WriteLine (table.Count + " types parsed.");
|
|
|
|
IDictionaryEnumerator de = table.GetEnumerator();
|
|
while (de.MoveNext()) {
|
|
IGeneratable gen = (IGeneratable) de.Value;
|
|
gen.Generate (table);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
}
|