| 1 |
/****************************************************************************** |
|---|
| 2 |
License: |
|---|
| 3 |
Copyright (c) 2007 Jarrett Billingsley |
|---|
| 4 |
|
|---|
| 5 |
This software is provided 'as-is', without any express or implied warranty. |
|---|
| 6 |
In no event will the authors be held liable for any damages arising from the |
|---|
| 7 |
use of this software. |
|---|
| 8 |
|
|---|
| 9 |
Permission is granted to anyone to use this software for any purpose, |
|---|
| 10 |
including commercial applications, and to alter it and redistribute it freely, |
|---|
| 11 |
subject to the following restrictions: |
|---|
| 12 |
|
|---|
| 13 |
1. The origin of this software must not be misrepresented; you must not |
|---|
| 14 |
claim that you wrote the original software. If you use this software in a |
|---|
| 15 |
product, an acknowledgment in the product documentation would be |
|---|
| 16 |
appreciated but is not required. |
|---|
| 17 |
|
|---|
| 18 |
2. Altered source versions must be plainly marked as such, and must not |
|---|
| 19 |
be misrepresented as being the original software. |
|---|
| 20 |
|
|---|
| 21 |
3. This notice may not be removed or altered from any source distribution. |
|---|
| 22 |
******************************************************************************/ |
|---|
| 23 |
|
|---|
| 24 |
module minidc; |
|---|
| 25 |
|
|---|
| 26 |
import minid.compiler; |
|---|
| 27 |
import minid.types; |
|---|
| 28 |
import minid.utils; |
|---|
| 29 |
|
|---|
| 30 |
import std.stdio; |
|---|
| 31 |
import std.stream; |
|---|
| 32 |
|
|---|
| 33 |
void printUsage() |
|---|
| 34 |
{ |
|---|
| 35 |
writefln("MiniD Compiler beta"); |
|---|
| 36 |
writefln(); |
|---|
| 37 |
writefln("Usage:"); |
|---|
| 38 |
writefln("\tminidc filename"); |
|---|
| 39 |
writefln(); |
|---|
| 40 |
writefln("This program is very straightforward. You give it the name of a .md"); |
|---|
| 41 |
writefln("file, and it will compile the module and write it to a binary .mdm file."); |
|---|
| 42 |
writefln("The output file will have the same name as the input file but with the"); |
|---|
| 43 |
writefln(".mdm extension."); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
void main(char[][] args) |
|---|
| 47 |
{ |
|---|
| 48 |
if(args.length != 2) |
|---|
| 49 |
{ |
|---|
| 50 |
printUsage(); |
|---|
| 51 |
return; |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
MDModuleDef def = compileModule(args[1]); |
|---|
| 55 |
scope f = new BufferedFile(args[1] ~ "m", FileMode.OutNew); |
|---|
| 56 |
Serialize(f, def); |
|---|
| 57 |
f.flush(); |
|---|
| 58 |
} |
|---|