mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 05:25:33 +00:00
65fec771bb
* Makefile.in : add gtkhtml dir. * configure.in : expand gtkhtml/Makefile * api/Makefile.in : remove gtkhtml-api.xml * generator/CodeGenerator.cs : parse new --outdir, --customdir, and --assembly-name args. * generator/GenerationInfo.cs (Ctor): new (dir, dir,assembly) ctor * gtkhtml/HTMLStream.custom : moved here from gtk dir * gtkhtml/gtkhtml-api.xml : moved here from api dir * gtkhtml/Makefile.in : gen source and build dll * sources/gtk-sharp-sources.xml : write gtkhtml api to new dir svn path=/trunk/gtk-sharp/; revision=18696
78 lines
1.9 KiB
C#
78 lines
1.9 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 = "";
|
|
|
|
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;
|
|
}
|
|
|
|
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 != "")
|
|
gen_info = new GenerationInfo (dir, custom_dir, assembly_name);
|
|
|
|
foreach (IGeneratable gen in gens) {
|
|
if (gen_info == null)
|
|
gen.Generate ();
|
|
else
|
|
gen.Generate (gen_info);
|
|
}
|
|
|
|
ObjectGen.GenerateMappers ();
|
|
|
|
Statistics.Report();
|
|
return 0;
|
|
}
|
|
}
|
|
}
|