protected override bool ParseOption(string name, CommandLineParseState ps) { if (name == "sequential") { if (ps.ConfirmArgumentCount(1)) { Debug.Assert(PipelineString == null); PipelineString = ps.args[ps.i]; } return(true); } if (name == "parallel") { if (ps.ConfirmArgumentCount(1)) { Pipeline.Sequential = false; Debug.Assert(PipelineString == null); PipelineString = ps.args[ps.i]; } return(true); } if (name == "noHoudini") { Pipeline.RunHoudini = false; return(true); } if (name == "writeKilledInvariantsToFile") { WriteKilledInvariantsToFile = true; return(true); } if (name == "replaceLoopInvariantAssertions") { ReplaceLoopInvariantAssertions = true; return(true); } if (name == "enableBarrierDivergenceChecks") { EnableBarrierDivergenceChecks = true; return(true); } return(base.ParseOption(name, ps)); }
protected override bool ParseOption(string name, CommandLineParseState ps) { var args = ps.args; switch (name) { case "warnDeadCode": WarnDeadCode = true; Mode = Modes.Block; return(true); case "generateTestMode": if (ps.ConfirmArgumentCount(1)) { Mode = args[ps.i] switch { "None" => Modes.None, "Block" => Modes.Block, "Path" => Modes.Path, _ => throw new Exception("Invalid value for testMode") }; } return(true); case "generateTestSeqLengthLimit": var limit = 0; if (ps.GetNumericArgument(ref limit)) { SeqLengthLimit = (uint)limit; } return(true); case "generateTestTargetMethod": if (ps.ConfirmArgumentCount(1)) { TargetMethod = args[ps.i]; } return(true); case "generateTestInlineDepth": var depth = 0; if (ps.GetNumericArgument(ref depth)) { TestInlineDepth = (uint)depth; } return(true); } return(false); }
/// <summary> /// Parses the command line options. /// </summary> /// <param name="name">The name of the option.</param> /// <param name="ps">The command line parsing state.</param> /// <returns>True if the parsing was successful.</returns> protected override bool ParseOption(string name, CommandLineParseState ps) { if (name == "detailedLogging") { if (ps.ConfirmArgumentCount(1)) { DetailedLogging = bool.Parse(ps.args[ps.i]); } return(true); } else if (name == "disableInspection") { if (ps.ConfirmArgumentCount(1)) { DisableInspection = bool.Parse(ps.args[ps.i]); } return(true); } else if (name == "disableGridBarriers") { if (ps.ConfirmArgumentCount(1)) { DisableGridBarriers = bool.Parse(ps.args[ps.i]); } return(true); } else if (name == "useAxioms") { if (ps.ConfirmArgumentCount(1)) { UseAxioms = bool.Parse(ps.args[ps.i]); } return(true); } else if (name == "sourceLanguage") { if (ps.ConfirmArgumentCount(1)) { SourceLanguage = ps.args[ps.i] == "cl" ? SourceLanguage.OpenCL : SourceLanguage.CUDA; } return(true); } return(base.ParseOption(name, ps)); }
protected override bool ParseOption(string name, CommandLineParseState ps) { var args = ps.args; switch (name) { case "contracts": int i = 0; if (ps.GetNumericArgument(ref i, 2)) Contracts = i == 1; return true; case "evalAnalysis": int j = 0; if (ps.GetNumericArgument(ref j, 2)) EvalAnalysis = j == 1; return true; case "parallel": int k = 0; if (ps.GetNumericArgument(ref k, 2)) ParallelExecution = k == 1; return true; case "lazy": int l = 0; if (ps.GetNumericArgument(ref l, 2)) LazyEval = l == 1; return true; case "printCsv": int m = 0; if (ps.GetNumericArgument(ref m, 2)) PrintCsv = m == 1; return true; case "search": int s = -1; if (ps.GetNumericArgument(ref s, 2)) EnableSearch = s; return true; default: break; } return base.ParseOption(name, ps); }
protected override bool ParseOption(string name, CommandLineParseState ps) { if (name == "sourceLanguage") { if (ps.ConfirmArgumentCount(1)) { if (ps.args[ps.i] == "cl") { SourceLanguage = SourceLanguage.OpenCL; } else if (ps.args[ps.i] == "cu") { SourceLanguage = SourceLanguage.CUDA; } } return(true); } if (name == "blockHighestDim") { int highestDim = BlockHighestDim; ps.GetNumericArgument(ref highestDim, 3); BlockHighestDim = highestDim; return(true); } if (name == "gridHighestDim") { int highestDim = GridHighestDim; ps.GetNumericArgument(ref highestDim, 3); GridHighestDim = highestDim; return(true); } if (name == "debugGPUVerify") { DebugGPUVerify = true; return(true); } if (name == "onlyIntraGroupRaceChecking") { OnlyIntraGroupRaceChecking = true; return(true); } if (name == "raceChecking") { if (ps.ConfirmArgumentCount(1)) { if (ps.args[ps.i] == "ORIGINAL") { RaceInstrumentationUtil.RaceCheckingMethod = RaceCheckingMethod.ORIGINAL; } else if (ps.args[ps.i] == "SINGLE") { RaceInstrumentationUtil.RaceCheckingMethod = RaceCheckingMethod.WATCHDOG_SINGLE; } else if (ps.args[ps.i] == "MULTIPLE") { RaceInstrumentationUtil.RaceCheckingMethod = RaceCheckingMethod.WATCHDOG_MULTIPLE; } } return(true); } if (name == "displayLoopAbstractions") { DisplayLoopAbstractions = true; return(true); } return(base.ParseOption(name, ps)); // defer to superclass }
/// <summary> /// Process the option and modify "ps" accordingly. /// Return true if the option is one that is recognized. /// </summary> protected virtual bool ParseOption(string name, CommandLineParseState ps) { Contract.Requires(name != null); Contract.Requires(ps != null); switch (name) { case "help": case "?": if (ps.ConfirmArgumentCount(0)) { HelpRequested = true; } return true; case "attrHelp": if (ps.ConfirmArgumentCount(0)) { AttrHelpRequested = true; } return true; default: break; } return false; // unrecognized option }
/// <summary> /// Parses the command-line arguments "args" into the global flag variables. Returns true /// if there were no errors. /// </summary> /// <param name="args">Consumed ("captured" and possibly modified) by the method.</param> public bool Parse([Captured] string[]/*!*/ args) { Contract.Requires(cce.NonNullElements(args)); // save the command line options for the log files Environment += "Command Line Options: " + args.Concat(" "); args = cce.NonNull((string[])args.Clone()); // the operations performed may mutate the array, so make a copy var ps = new CommandLineParseState(args, ToolName); while (ps.i < args.Length) { cce.LoopInvariant(ps.args == args); string arg = args[ps.i]; Contract.Assert(arg != null); ps.s = arg.Trim(); bool isOption = ps.s.StartsWith("-") || ps.s.StartsWith("/"); int colonIndex = ps.s.IndexOf(':'); if (0 <= colonIndex && isOption) { ps.hasColonArgument = true; args[ps.i] = ps.s.Substring(colonIndex + 1); ps.s = ps.s.Substring(0, colonIndex); } else { ps.i++; ps.hasColonArgument = false; } ps.nextIndex = ps.i; if (isOption) { if (!ParseOption(ps.s.Substring(1), ps)) { if (Path.DirectorySeparatorChar == '/' && ps.s.StartsWith("/")) this._files.Add(arg); else ps.Error("unknown switch: {0}", ps.s); } } else { this._files.Add(arg); } ps.i = ps.nextIndex; } if (HelpRequested) { Usage(); } else if (AttrHelpRequested) { AttributeUsage(); } else if (ps.EncounteredErrors) { Console.WriteLine("Use /help for available options"); } if (ps.EncounteredErrors) { return false; } else { this.ApplyDefaultOptions(); return true; } }
protected override bool ParseOption(string name, CommandLineParseState ps) { var args = ps.args; switch (name) { case "contracts": int i = 0; if (ps.GetNumericArgument(ref i, 2)) { Contracts = i == 1; } return(true); case "evalAnalysis": int j = 0; if (ps.GetNumericArgument(ref j, 2)) { EvalAnalysis = j == 1; } return(true); case "parallel": int k = 0; if (ps.GetNumericArgument(ref k, 2)) { ParallelExecution = k == 1; } return(true); case "lazy": int l = 0; if (ps.GetNumericArgument(ref l, 2)) { LazyEval = l == 1; } return(true); case "printCsv": int m = 0; if (ps.GetNumericArgument(ref m, 2)) { PrintCsv = m == 1; } return(true); case "search": int s = -1; if (ps.GetNumericArgument(ref s, 2)) { EnableSearch = s; } return(true); default: break; } return(base.ParseOption(name, ps)); }
/// <summary> /// Parses the command line options. /// </summary> /// <param name="name">The name of the option.</param> /// <param name="ps">The command line parsing state.</param> /// <returns>True if the parsing was successful.</returns> protected override bool ParseOption(string name, CommandLineParseState ps) { if (name == "detailedLogging") { if (ps.ConfirmArgumentCount(1)) { DetailedLogging = bool.Parse(ps.args[ps.i]); } return(true); } else if (name == "logClauses") { if (ps.ConfirmArgumentCount(1)) { LogClauses = bool.Parse(ps.args[ps.i]); } return(true); } else if (name == "disableInspection") { if (ps.ConfirmArgumentCount(1)) { DisableInspection = bool.Parse(ps.args[ps.i]); } return(true); } else if (name == "useAxioms") { if (ps.ConfirmArgumentCount(1)) { UseAxioms = bool.Parse(ps.args[ps.i]); } return(true); } else if (name == "loopDepthWeight") { if (ps.ConfirmArgumentCount(1)) { LoopDepthWeight = int.Parse(ps.args[ps.i]); } return(true); } else if (name == "gridBarrierWeight") { if (ps.ConfirmArgumentCount(1)) { GridBarrierWeight = int.Parse(ps.args[ps.i]); } return(true); } else if (name == "solverType") { if (ps.ConfirmArgumentCount(1)) { SolverType = (Solver.SolverType)Enum.Parse(typeof(Solver.SolverType), ps.args[ps.i]); } return(true); } return(base.ParseOption(name, ps)); }
protected void InvalidArgumentError(string name, CommandLineParseState ps) { ps.Error("Invalid argument \"{0}\" to option {1}", ps.args[ps.i], name); }
public new String[] Parse([Captured] string[] /*!*/ args) { Contract.Requires(cce.NonNullElements(args)); List <String> ret_list = new List <String>(); // save the command line options for the log files args = cce.NonNull((string[])args.Clone()); // the operations performed may mutate the array, so make a copy var ps = new CommandLineParseState(args, ToolName); while (ps.i < args.Length) { cce.LoopInvariant(ps.args == args); string arg = args[ps.i]; Contract.Assert(arg != null); ps.s = arg.Trim(); bool isOption = ps.s.StartsWith("-") || ps.s.StartsWith("/"); int colonIndex = ps.s.IndexOf(':'); if (0 <= colonIndex && isOption) { ps.hasColonArgument = true; args[ps.i] = ps.s.Substring(colonIndex + 1); ps.s = ps.s.Substring(0, colonIndex); } else { ps.i++; ps.hasColonArgument = false; } ps.nextIndex = ps.i; if (isOption) { if (!ParseOption(ps.s.Substring(1), ps)) { ret_list.Add(arg); } } else { ret_list.Add(arg); } ps.i = ps.nextIndex; } if (HelpRequested) { Usage(); } else if (AttrHelpRequested) { AttributeUsage(); } else if (ps.EncounteredErrors) { Console.WriteLine("Use /help for available options"); } if (ps.EncounteredErrors) { Console.WriteLine("Error while parsing boomble options!"); return(new string[0]); } else { this.ApplyDefaultOptions(); } return(ret_list.ToArray()); }