[svn] r5960: nemerle/trunk/ncc/main.n
malekith
svnadmin at nemerle.org
Tue Nov 22 15:38:19 CET 2005
Log:
Make the -stack-size option actually work. Add new undocumented -stack-size-k option, for fine grained setting of the stack size.
Author: malekith
Date: Tue Nov 22 15:38:18 2005
New Revision: 5960
Modified:
nemerle/trunk/ncc/main.n
Modified: nemerle/trunk/ncc/main.n
==============================================================================
--- nemerle/trunk/ncc/main.n (original)
+++ nemerle/trunk/ncc/main.n Tue Nov 22 15:38:18 2005
@@ -52,14 +52,15 @@
{
module MainClass
{
- mutable stack_megs : int = 0;
+ mutable stack_kilos : int = 0;
public Main () : void
{
- if (stack_megs != 0 || needs_bigger_stack ()) {
- when (stack_megs == 0)
- stack_megs = 16;
- def thread = System.Threading.Thread (main_with_catching, stack_megs * 1024 * 1024);
+ parse_command_line ();
+ if (stack_kilos != 0 || needs_bigger_stack ()) {
+ when (stack_kilos == 0)
+ stack_kilos = 16 * 1024;
+ def thread = System.Threading.Thread (main_with_catching, stack_kilos * 1024);
thread.Start ();
thread.Join ();
} else
@@ -73,9 +74,13 @@
main_with_catching () : void
{
- Message.InitOutput (System.Console.Out);
try {
- do_main ()
+ def this_dir = typeof (MainClass).Assembly.Location;
+ LibraryReferenceManager.AddSearchDirectory
+ (LibraryReferenceManager.DirectoryOfCodebase (this_dir));
+
+ // run compilation with already created options
+ Passes.Run ()
} catch {
| e is System.IO.FileNotFoundException =>
Message.Error (e.Message)
@@ -108,7 +113,10 @@
System.Environment.Exit (2);
}
- do_main () : void {
+ parse_command_line () : void
+ {
+ Message.InitOutput (System.Console.Out);
+
mutable files = [];
def print_version () {
@@ -128,7 +136,11 @@
Getopt.CliOption.Int (name = "-stack-size",
aliases = [],
help = "Set stack size of the compiler to INT megabytes",
- handler = fun (k) { stack_megs = k; }),
+ handler = fun (k) { stack_kilos = k * 1024; }),
+ Getopt.CliOption.Int (name = "-stack-size-k",
+ aliases = [],
+ help = "NOHELP",
+ handler = fun (k) { stack_kilos = k; }),
Getopt.CliOption.Flag (name = "-version",
aliases = ["-V"],
help = "Output version information and exit",
@@ -150,13 +162,6 @@
Getopt.Error ("need at least one file to compile\n" + Getopt.Usage (opts))
| _ =>
Options.Sources = files;
-
- def this_dir = typeof (MainClass).Assembly.Location;
- LibraryReferenceManager.AddSearchDirectory
- (LibraryReferenceManager.DirectoryOfCodebase (this_dir));
-
- // run compilation with already created options
- Passes.Run ()
}
}
}
More information about the svn
mailing list