static bool ParseOption(DebuggerOptions debug_options,
string option,
ref string [] args,
ref int i,
ref bool parsing_options)
{
int idx = option.IndexOf (':');
string arg, value, ms_value = null;
if (idx == -1){
arg = option;
} else {
arg = option.Substring (0, idx);
ms_value = option.Substring (idx + 1);
}
switch (arg) {
case "-working-directory":
case "-cd":
value = GetValue (ref args, ref i, ms_value);
if (value == null) {
Usage ();
Environment.Exit (1);
}
debug_options.WorkingDirectory = value;
return true;
case "-debug-flags":
value = GetValue (ref args, ref i, ms_value);
if (!ParseDebugFlags (debug_options, value)) {
Console.WriteLine ("Unknown -debug-flags argument: {0}", ms_value);
Environment.Exit (1);
}
return true;
case "-jit-optimizations":
value = GetValue (ref args, ref i, ms_value);
if (value == null) {
Usage ();
Environment.Exit (1);
}
debug_options.JitOptimizations = value;
return true;
case "-jit-arg":
value = GetValue (ref args, ref i, ms_value);
if (ms_value == null) {
Usage ();
Environment.Exit (1);
}
if (debug_options.JitArguments != null) {
string[] old = debug_options.JitArguments;
string[] new_args = new string [old.Length + 1];
old.CopyTo (new_args, 0);
new_args [old.Length] = value;
debug_options.JitArguments = new_args;
} else {
debug_options.JitArguments = new string[] { value };
}
return true;
case "-mono-prefix":
value = GetValue (ref args, ref i, ms_value);
if (value == null) {
Usage ();
Environment.Exit (1);
}
debug_options.MonoPrefix = value;
return true;
case "-mono":
value = GetValue (ref args, ref i, ms_value);
if (value == null) {
Usage ();
Environment.Exit (1);
}
debug_options.MonoPath = value;
return true;
case "-script":
if (ms_value != null) {
Usage ();
Environment.Exit (1);
}
debug_options.IsScript = true;
return true;
case "-version":
case "-V":
if (ms_value != null) {
Usage ();
Environment.Exit (1);
}
About();
Environment.Exit (1);
return true;
case "-help":
case "--help":
case "-h":
case "-usage":
if (ms_value != null) {
Usage ();
Environment.Exit (1);
}
Usage();
Environment.Exit (1);
return true;
case "-start":
if (ms_value != null) {
Usage ();
Environment.Exit (1);
}
debug_options.StartTarget = true;
debug_options.StopInMain = false;
return true;
case "-run":
if (ms_value != null) {
Usage ();
Environment.Exit (1);
}
debug_options.StartTarget = true;
debug_options.StopInMain = true;
return true;
#if HAVE_XSP
case "-xsp":
value = GetValue (ref args, ref i, ms_value);
if (value == null) {
Usage ();
Environment.Exit (1);
}
debug_options.StartXSP = true;
debug_options.XSP_Root = value;
debug_options.SetupXSP ();
parsing_options = false;
return true;
#endif
}
return false;
}