| 1 |
/* |
| 2 |
Copyright(C) 2001-2002 arton |
| 3 |
|
| 4 |
Permission is granted for use, copying, modification, distribution, |
| 5 |
and distribution of modified versions of this work as long as the |
| 6 |
above copyright notice is included. |
| 7 |
*/ |
| 8 |
using System; |
| 9 |
using System.Threading; |
| 10 |
using System.Reflection; |
| 11 |
using System.IO; |
| 12 |
using System.CodeDom.Compiler; |
| 13 |
using System.ComponentModel; |
| 14 |
|
| 15 |
[assembly: AssemblyTitle("NRr")] |
| 16 |
[assembly: AssemblyVersion("0.8.*")] |
| 17 |
[assembly: AssemblyCopyright("NRr - Copyright (C) 2002 arton")] |
| 18 |
|
| 19 |
namespace arton.NETRuby |
| 20 |
{ |
| 21 |
class NRbCodeProvider : CodeDomProvider |
| 22 |
{ |
| 23 |
private NetRuby ruby; |
| 24 |
|
| 25 |
public NRbCodeProvider() |
| 26 |
{ |
| 27 |
ruby = new NetRuby(); |
| 28 |
} |
| 29 |
|
| 30 |
public override string FileExtension |
| 31 |
{ |
| 32 |
get { return "rb"; } |
| 33 |
} |
| 34 |
public override LanguageOptions LanguageOptions |
| 35 |
{ |
| 36 |
get { return LanguageOptions.None; } |
| 37 |
} |
| 38 |
public override ICodeCompiler CreateCompiler() |
| 39 |
{ |
| 40 |
return null; |
| 41 |
} |
| 42 |
public override ICodeGenerator CreateGenerator() |
| 43 |
{ |
| 44 |
return null; |
| 45 |
} |
| 46 |
public override ICodeGenerator CreateGenerator(string fileName) |
| 47 |
{ |
| 48 |
return null; |
| 49 |
} |
| 50 |
public override ICodeGenerator CreateGenerator(TextWriter output) |
| 51 |
{ |
| 52 |
return null; |
| 53 |
} |
| 54 |
public override System.Runtime.Remoting.ObjRef CreateObjRef(Type requestedType) |
| 55 |
{ |
| 56 |
return base.CreateObjRef(requestedType); |
| 57 |
} |
| 58 |
public override ICodeParser CreateParser() |
| 59 |
{ |
| 60 |
return null; |
| 61 |
} |
| 62 |
protected override void Dispose(bool disposing) |
| 63 |
{ |
| 64 |
if (disposing) |
| 65 |
{ |
| 66 |
// do something else |
| 67 |
} |
| 68 |
base.Dispose(disposing); |
| 69 |
} |
| 70 |
public override TypeConverter GetConverter(Type type) |
| 71 |
{ |
| 72 |
return base.GetConverter(type); |
| 73 |
} |
| 74 |
|
| 75 |
public static void Main(string[] args) |
| 76 |
{ |
| 77 |
if (args.Length <= 0) |
| 78 |
{ |
| 79 |
Console.WriteLine("NRr filename"); |
| 80 |
return; |
| 81 |
} |
| 82 |
long s1 = DateTime.Now.Ticks; |
| 83 |
NetRuby rb = new NetRuby(); |
| 84 |
long s2 = DateTime.Now.Ticks; |
| 85 |
long s3 = 0; |
| 86 |
if (rb.Options(args)) |
| 87 |
{ |
| 88 |
s3 = DateTime.Now.Ticks; |
| 89 |
rb.RunWithCompile(); |
| 90 |
} |
| 91 |
long s4 = DateTime.Now.Ticks; |
| 92 |
System.Console.WriteLine(String.Format("new={0},Process={1},Run={2}",(s2 - s1)/10000, (s3 - s2)/10000, (s4 - s3)/10000)); |
| 93 |
rb.Exit(0); |
| 94 |
} |
| 95 |
} |
| 96 |
} |