GtkSharp/generator/CodeGenerator.cs
Mike Kestner 9861569931 2004-03-18 Mike Kestner <mkestner@ximian.com>
* configure.in : expand atk/glue/Makefile
	* atk/Makefile.am : generate glue and build glue dir
	* atk/makefile.win32 : ditto
	* atk/glue/Makefile.am : build new glue
	* atk/glue/makefile.win32 : build new glue
	* atk/glue/vmglueheaders.h : new includes for vm glue
	* atk/glue/win32dll.c : win dll building code
	* generator/CodeGenerator.cs : add --gluelib-name and
	--glue-filename argument parsing.
	* generator/GenerationInfo.cs : add GluelibName, GlueFilename,
	GlueEnabled, GlueWriter, and CloseGlueWriter.
	* generator/ObjectGen.cs : Add VirtualMethod glue generation
	* generator/Statistics.cs : Add warning message for virtual
	method throttling.

svn path=/trunk/gtk-sharp/; revision=24292
2004-03-18 20:56:32 +00:00

91 lines
2.3 KiB
C#

// GtkSharp.Generation.CodeGenerator.cs - The main code generation engine.
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001-2003 Mike Kestner and Ximian Inc.
namespace GtkSharp.Generation {
using System;
using System.Collections;
using System.Xml;
public class CodeGenerator {
public static int Main (string[] args)
{
if (args.Length < 2) {
Console.WriteLine ("Usage: codegen --generate <filename1...>");
return 0;
}
bool generate = false;
bool include = false;
string dir = "";
string custom_dir = "";
string assembly_name = "";
string glue_filename = "";
string gluelib_name = "";
SymbolTable table = SymbolTable.Table;
ArrayList gens = new ArrayList ();
foreach (string arg in args) {
if (arg == "--generate") {
generate = true;
include = false;
continue;
} else if (arg == "--include") {
generate = false;
include = true;
continue;
} else if (arg.StartsWith ("--outdir=")) {
include = generate = false;
dir = arg.Substring (9);
continue;
} else if (arg.StartsWith ("--customdir=")) {
include = generate = false;
custom_dir = arg.Substring (12);
continue;
} else if (arg.StartsWith ("--assembly-name=")) {
include = generate = false;
assembly_name = arg.Substring (16);
continue;
} else if (arg.StartsWith ("--glue-filename=")) {
include = generate = false;
glue_filename = arg.Substring (16);
continue;
} else if (arg.StartsWith ("--gluelib-name=")) {
include = generate = false;
gluelib_name = arg.Substring (15);
continue;
}
Parser p = new Parser ();
IGeneratable[] curr_gens = p.Parse (arg);
table.AddTypes (curr_gens);
if (generate)
gens.AddRange (curr_gens);
}
GenerationInfo gen_info = null;
if (dir != "" || assembly_name != "" || glue_filename != "" || gluelib_name != "")
gen_info = new GenerationInfo (dir, custom_dir, assembly_name, glue_filename, gluelib_name);
foreach (IGeneratable gen in gens) {
if (gen_info == null)
gen.Generate ();
else
gen.Generate (gen_info);
}
ObjectGen.GenerateMappers ();
if (gen_info != null)
gen_info.CloseGlueWriter ();
Statistics.Report();
return 0;
}
}
}