The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
EntryPoint.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: EntryPoint.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Co-author: Miguel Garcia - miguel.uniovi@gmail.com //
8 // Description: //
9 // Application's entry point. //
10 // -------------------------------------------------------------------------- //
11 // Create date: 28-11-2006 //
12 // Modification date: 23-02-2011 //
14 
15 using System;
16 using System.IO;
17 using System.Collections.Generic;
18 using ErrorManagement;
19 using System.Windows.Forms;
20 using TargetPlatforms;
21 
22 namespace Inference.Core {
23  class EntryPoint {
24  #region Main
25 
26  static void Main(string[] args) {
27 #if DEBUG
28  long startTime = DateTime.Now.Ticks;
29  ConsoleColor previousColor;
30 #endif
31 
32  try {
33  // if we have at least one command-line argument
34  if (args.Length > 0) {
35 #if DEBUG
36  previousColor = Console.ForegroundColor;
37  Console.ForegroundColor = ConsoleColor.DarkGray;
38  Console.Error.WriteLine("Compiling...");
39  Console.ForegroundColor = previousColor;
40 #endif
41  Program initApp = new Program();
42  // * filename : directoryname map
43  IDictionary<string, string> directories = new Dictionary<string, string>();
44 
45  // for each directory/file specified on the command line
46  for (int i = 0; i < args.Length; i++) {
47  if ((File.Exists(args[i])) || (Directory.Exists(args[i])))
48  initApp.LoadFile(new FileInfo(args[i]), directories);
49  else {
50  ErrorManager.Instance.NotifyError(new FileNotFoundError(args[i]));
51  return;
52  }
53  }
54 
55  // starts the compilation process
56  initApp.Run(directories, null, Application.StartupPath+"\\Tests\\",
57  "ilasm.exe", "TypeTable.txt", TargetPlatform.CLR, false,false);
58  }
59  else
60  ErrorManager.Instance.NotifyError(new CommandLineArgumentsError());
61  } catch (System.Exception e) {
62  Console.Error.WriteLine("Exception: " + e);
63  Console.Error.WriteLine(e.StackTrace);
64  }
65 #if DEBUG
66  double elapsedTime = ((DateTime.Now.Ticks - startTime) / TimeSpan.TicksPerMillisecond) / 1000.0;
67  previousColor = Console.ForegroundColor;
68  Console.ForegroundColor = ConsoleColor.DarkGray;
69  System.Console.Out.WriteLine("\n\nTotal compilation time was {0} seconds.", elapsedTime);
70  Console.ForegroundColor = previousColor;
71 #endif
72  //Console.ReadLine();
73  }
74 
75  #endregion
76  }
77 }
Definition: EntryPoint.cs:23
Represents the error occurred when the command line arguments specified are incorrect.
System.IO.FileInfo FileInfo
Definition: CSharpParser.cs:5
Represents the error occurred when the file specified does not exist.