Esempio n. 1
0
    /// <summary>
    /// Worker thread.
    /// </summary>
    /// <param name="args"></param>
    /// <returns></returns>
    public static int ExecuteTacny(string[] args) {

      Debug.Listeners.Clear();
      Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

      Debug.AutoFlush = true;
      // install Dafny and Boogie commands
      var options = new TacnyOptions { VerifySnapshots = 2 };
      TacnyOptions.Install(options);
      _printer = new TacnyConsolePrinter();
      ExecutionEngine.printer = new ConsolePrinter();

      ExitValue exitValue;

      // parse command line args
      //Util.TacnyOptions.O.Parse(args);
      if (!CommandLineOptions.Clo.Parse(args)) {
        exitValue = ExitValue.PreprocessingError;
        return (int)exitValue;
      }

      if (CommandLineOptions.Clo.Files.Count == 0) {
        _printer.ErrorWriteLine(Console.Out, "*** Error: No input files were specified.");
        exitValue = ExitValue.PreprocessingError;
        return (int)exitValue;
      }
      Console.Out.WriteLine("BEGIN: Tacny Options");
      var tc = TacnyOptions.O;
      FieldInfo[] fields = tc.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
      foreach (var field in fields) {

        if (field.IsPublic) {
          if (field.Name == "EnableSearch") {
            var val = field.GetValue(tc);
            if (!(val is int)) continue;
            var tmp = (int)val;
            if (tmp < 0) continue;
            var name = (LazyTacny.Strategy)tmp;
            Console.Out.WriteLine($"# SearchStrategy : {name}");
          } else
            Console.Out.WriteLine($"# {field.Name} : {field.GetValue(tc)}");
        }

      }

      Console.Out.WriteLine("END: Tacny Options");
      exitValue = ProcessFiles(CommandLineOptions.Clo.Files);

      return (int)exitValue;
    }
Esempio n. 2
0
 public static void Install(TacnyOptions options)
 {
     Contract.Requires(options != null);
     clo = options;
     DafnyOptions.Install(options);
 }