blob: ecbee795469b0ae43ed971f1e1afccfe9a29ebd1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace GPUVerify
{
class CommandLineOptions
{
public static List<string> inputFiles = new List<string>();
public static string outputFile = null;
public static string formulaSkeletonsFile = null;
public static int Parse(string[] args)
{
for (int i = 0; i < args.Length; i++)
{
bool hasColonArgument = false;
string beforeColon;
string afterColon = null;
int colonIndex = args[i].IndexOf(':');
if (colonIndex >= 0 && (args[i].StartsWith("-") || args[i].StartsWith("/"))) {
hasColonArgument = true;
beforeColon = args[i].Substring(0, colonIndex);
afterColon = args[i].Substring(colonIndex + 1);
} else {
beforeColon = args[i];
}
switch (beforeColon)
{
case "-print":
case "/print":
if (!hasColonArgument)
{
Console.WriteLine("Error: filename expected after " + beforeColon + " argument");
Environment.Exit(1);
}
Debug.Assert(afterColon != null);
outputFile = afterColon;
break;
case "-generateFormulaSkeletons":
case "/generateFormulaSkeletons":
if (!hasColonArgument)
{
Console.WriteLine("Error: filename expected after " + beforeColon + " argument");
Environment.Exit(1);
}
Debug.Assert(afterColon != null);
formulaSkeletonsFile = afterColon;
break;
default:
inputFiles.Add(args[i]);
break;
}
}
return 0;
}
}
}
|