Пример #1
0
        // Prints the policy
        public void print(TokenTextWriter writer)
        {
            if (writer == null)
            {
                return;
            }

            writer.WriteLine("=================================");
            writer.WriteLine("The instrumentation policy:");
            writer.Write("  Globals to instrument: ");

            foreach (var s in globalsToInstrument)
            {
                writer.Write("{0}  ", s);
            }

            writer.WriteLine();

            /*
             * writer.Write("  Procedures without implementation: ");
             * foreach (var s in procsWithoutImpl)
             * {
             *  writer.Write("{0}  ", s);
             * }
             * writer.WriteLine();
             *
             * writer.WriteLine("  Atomic-block procedures: {0}  {1}", atomicBeginProcName, atomicEndProcName);
             * writer.WriteLine("  Assertion procedure: {0}", assertNotReachableName);
             */
            writer.WriteLine("=================================");
        }
Пример #2
0
        public static void DumpExceptionInformation(Exception e)
        {
            const string DUMP_FILE = "__whoopdump.txt";

            #region Give generic internal error messsage
            Console.Error.WriteLine("\nWhoop: an internal error has occurred, details written to " + DUMP_FILE + ".");
            #endregion

            #region Now try to give the user a specific hint if this looks like a common problem
            try
            {
                throw e;
            }
            catch (ProverException)
            {
                Console.Error.WriteLine("Hint: It looks like Whoop is having trouble invoking its");
                Console.Error.WriteLine("supporting theorem prover, which by default is Z3.");
                Console.Error.WriteLine("Have you installed Z3?");
            }
            catch (Exception)
            {
                // Nothing to say about this
            }
            #endregion

            #region Write details of the exception to the dump file
            using (TokenTextWriter writer = new TokenTextWriter(DUMP_FILE, true))
            {
                writer.Write("Exception ToString:");
                writer.Write("===================");
                writer.Write(e.ToString());
                writer.Close();
            }
            #endregion
        }
Пример #3
0
            public static void DumpExceptionInformation(Exception e)
            {
                if (e.ToString().Contains("An attempt was made to load an assembly from a network location"))
                {
                    Console.Error.WriteLine();
                    Console.Error.WriteLine("GPUVerify has had trouble loading one of its components due to security settings.");
                    Console.Error.WriteLine();
                    Console.Error.WriteLine("In order to run GPUVerify successfully you need to unblock the archive before unzipping it.");
                    Console.Error.WriteLine();
                    Console.Error.WriteLine("To do this:");
                    Console.Error.WriteLine(" - Right click on the .zip file");
                    Console.Error.WriteLine(" - Click \"Properties\"");
                    Console.Error.WriteLine(" - At the bottom of the \"General\" tab you should see:");
                    Console.Error.WriteLine("     Security: This file came from another computer and might be blocked");
                    Console.Error.WriteLine("     to help protect this computer.");
                    Console.Error.WriteLine(" - Click \"Unblock\"");
                    Console.Error.WriteLine(" - Click \"OK\"");
                    Console.Error.WriteLine("Once this is done, unzip GPUVerify afresh and this issue should be resolved.");
                    Environment.Exit((int)ToolExitCodes.INTERNAL_ERROR);
                }

                const string DUMP_FILE = "__gvdump.txt";

                // Give generic internal error message
                Console.Error.WriteLine("\nGPUVerify: an internal error has occurred, details written to " + DUMP_FILE + ".");
                Console.Error.WriteLine();
                Console.Error.WriteLine("Please consult the troubleshooting guide in the GPUVerify documentation");
                Console.Error.WriteLine("for common problems, and if this does not help, raise an issue via the");
                Console.Error.WriteLine("GPUVerify issue tracker:");
                Console.Error.WriteLine();
                Console.Error.WriteLine("  https://github.com/mc-imperial/gpuverify");
                Console.Error.WriteLine();

                // Now try to give the user a specific hint if this looks like a common problem
                try
                {
                    throw e;
                }
                catch (ProverException)
                {
                    Console.Error.WriteLine("Hint: It looks like GPUVerify is having trouble invoking its");
                    Console.Error.WriteLine("supporting theorem prover, which by default is Z3.  Have you");
                    Console.Error.WriteLine("installed Z3?");
                }
                catch (Exception)
                {
                    // Nothing to say about this
                }

                // Write details of the exception to the dump file
                using (TokenTextWriter writer = new TokenTextWriter(DUMP_FILE, false))
                {
                    writer.Write("Exception ToString:");
                    writer.Write("===================");
                    writer.Write(e.ToString());
                }
            }
Пример #4
0
 public void Emit(TokenTextWriter t)
 {
     t.Write("vtask: (" + Eq.Name + ", " + Left.Name + ", " + Right.Name + ")");
     if (DesiredOutputVars.Count > 0)
     {
         t.Write(" / ");
         foreach (var v in DesiredOutputVars)
         {
             t.Write(v.Name + "; ");
         }
     }
     t.WriteLine();
 }
Пример #5
0
        public static bool Write(int level, string msg, params object[] args)
        {
            if (level == Log.Normal)
            {
                Write(Log.Debug, msg, args);
            }

            switch (level)
            {
            case Debug:
                if (!noDebuggingOutput)
                {
                    init();
                    debugOut.Write(msg, args);
                }
                break;

            case Warning:
                Console.Write("Warning: " + msg, args);
                break;

            case Error:
                Console.Write("Error: " + msg, args);
                break;

            case Normal:
                Console.Write(msg, args);
                break;
            }

            return(false);
        }
Пример #6
0
 private static void printIndent(TokenTextWriter ttw, int indent)
 {
     for (int i = 0; i < indent; i++)
     {
         ttw.Write(" ");
     }
 }
Пример #7
0
 public void Emit(TokenTextWriter t)
 {
     Console.Write("\t");
     Source.Emit(t, 0);
     if (!Cons.IsTrue())
     {
         t.WriteLine("\t\tPre: ");
         t.Write("\t\t\t");
         Cons.Emit(t);
         t.WriteLine();
     }
     if (Gammas.Count != 0)
     {
         t.WriteLine("\t\tGammas:");
         for (int i = 0; i < Gammas.Count; i++)
         {
             if (Gammas.Count > 1)
             {
                 t.WriteLine("\t\t\t" + i + ": ");
             }
             Gammas[i].Emit(t);
             t.WriteLine("===============");
         }
     }
 }
Пример #8
0
 public void Emit(TokenTextWriter t)
 {
     foreach (var kv in this)
     {
         t.Write("\t\t\t" + kv.Key.ToString() + ": ");
         kv.Value.Emit(t);
         Console.WriteLine();
     }
 }
 public void print(TokenTextWriter ttw)
 {
     ttw.Write(blockName + ":" + num.ToString() +
               (type.type == InstrTypeEnum.CALL
         ? ":call" :
                (type.type == InstrTypeEnum.ASYNC
         ? ":async" :
                 "")));
 }
Пример #10
0
        public void Emit(TokenTextWriter t)
        {
            if (Conjuncts.Count == 0)
            {
                t.Write("true");
            }
            else
            {
                var ss = new List <string>();
                foreach (var c in Conjuncts)
                {
                    var cur = Util.BufEmit(c.Emit);
                    if (Options.DontPrintDuplicateConstraintConjuncts)
                    {
                        if (!ss.Contains(cur))
                        {
                            ss.Add(cur);
                        }
                    }
                    else
                    {
                        ss.Add(cur);
                    }
                }
                var emit = ss[0] + "\n";
                for (int i = 1; i < ss.Count; i++)
                {
                    emit += " AND " + ss[i] + "\n";
                }
                t.Write(emit);
            }

            //foreach (var e in Conjuncts)
            //{
            //  if (Util.BufEmit(e.Emit).Equals("0 == 0"))
            //    continue;
            //  t.Write(" AND ");
            //  e.Emit(t);
            //  t.WriteLine();
            //}
        }
Пример #11
0
        public void PrintInfo(TokenTextWriter writer)
        {
            if (writer == null)
            {
                return;
            }

            writer.WriteLine("=================================");
            writer.WriteLine("Here's what we know of the program:");



            writer.Write("Declared globals: ");
            foreach (var g in declaredGlobals)
            {
                writer.Write(g.Key + " ");
            }
            writer.Write("\n");

            writer.Write("Modified globals: ");
            foreach (var g in modifiedGlobals)
            {
                writer.Write(g.Key + " ");
            }
            writer.Write("\n");

            writer.WriteLine("Main procedure: {0}", mainProcName);

            writer.WriteLine("=================================");
        }
Пример #12
0
        public void Emit(IList <Expr> args, TokenTextWriter stream, int contextBindingStrength, bool fragileContext)
        {
            Debug.Assert(args.Count == ArgumentCount);

            // TODO: Don't ignore contextBindingStrength and fragileContext
            stream.SetToken(ref this.Token);
            var popRequired = stream.push(FunctionName);

            stream.Write(this.FunctionName);
            stream.Write("(");
            for (int index = 0; index < args.Count; ++index)
            {
                args[index].Emit(stream, contextBindingStrength, fragileContext);

                if (index < (args.Count - 1))
                {
                    stream.Write(", ");
                }
            }

            stream.Write(")");
            stream.pop(popRequired);
        }
Пример #13
0
 public void Emit(TokenTextWriter stream) {
   Contract.Requires(stream != null);
   stream.SetToken(this);
   Contract.Assert(this.Tr.Count >= 1);
   string/*!*/ sep = Pos ? "{ " : "{:nopats ";
   foreach (Expr/*!*/ e in this.Tr) {
     Contract.Assert(e != null);
     stream.Write(sep);
     sep = ", ";
     e.Emit(stream);
   }
   stream.Write(" }");
 }
Пример #14
0
    public override void Emit(TokenTextWriter stream, int contextBindingStrength, bool fragileContext) {
      //Contract.Requires(stream != null);
      stream.push();
      stream.Write(this, "({0}", Kind.ToString().ToLower());
      this.EmitTypeHint(stream);
      Type.EmitOptionalTypeParams(stream, TypeParameters);
      stream.Write(this, " ");
      this.Dummies.Emit(stream, true);
      stream.Write(" :: ");
      stream.sep();
      for (QKeyValue kv = this.Attributes; kv != null; kv = kv.Next) {
        kv.Emit(stream);
        stream.Write(" ");
      }
      this.EmitTriggers(stream);
      stream.sep();

      this.Body.Emit(stream);
      stream.Write(")");
      stream.pop();
    }
Пример #15
0
 public override void Emit(TokenTextWriter stream, int level)
 {
     //Contract.Requires(stream != null);
       stream.Write(this, level, "");
       if (IsFree) {
     stream.Write("free ");
       }
       if (IsAsync) {
     stream.Write("async ");
       }
       stream.Write("call ");
       EmitAttributes(stream, Attributes);
       string sep = "";
       if (Outs.Count > 0) {
     foreach (Expr arg in Outs) {
       stream.Write(sep);
       sep = ", ";
       if (arg == null) {
     stream.Write("*");
       } else {
     arg.Emit(stream);
       }
     }
     stream.Write(" := ");
       }
       stream.Write(TokenTextWriter.SanitizeIdentifier(callee));
       stream.Write("(");
       sep = "";
       foreach (Expr arg in Ins) {
     stream.Write(sep);
     sep = ", ";
     if (arg == null) {
       stream.Write("*");
     } else {
       arg.Emit(stream);
     }
       }
       stream.WriteLine(");");
       base.Emit(stream, level);
 }
Пример #16
0
        public override void Emit(TokenTextWriter stream, int level)
        {
            stream.Write(this, level, "");

              string/*!*/ sep = "";
              foreach (AssignLhs/*!*/ l in Lhss) {
            Contract.Assert(l != null);
            stream.Write(sep);
            sep = ", ";
            l.Emit(stream);
              }

              stream.Write(" := ");

              sep = "";
              foreach (Expr/*!*/ e in Rhss) {
            Contract.Assert(e != null);
            stream.Write(sep);
            sep = ", ";
            e.Emit(stream);
              }

              stream.WriteLine(";");
        }
Пример #17
0
    public override void Emit(TokenTextWriter stream, int level) {
      //Contract.Requires(stream != null);
      stream.Write(this, level, "procedure ");
      EmitAttributes(stream);
      stream.Write(this, level, "{0}", TokenTextWriter.SanitizeIdentifier(this.Name));
      EmitSignature(stream, false);
      stream.WriteLine(";");

      level++;

      foreach (Requires/*!*/ e in this.Requires) {
        Contract.Assert(e != null);
        e.Emit(stream, level);
      }

      if (this.Modifies.Count > 0) {
        stream.Write(level, "modifies ");
        this.Modifies.Emit(stream, false);
        stream.WriteLine(";");
      }

      foreach (Ensures/*!*/ e in this.Ensures) {
        Contract.Assert(e != null);
        e.Emit(stream, level);
      }

      if (!CommandLineOptions.Clo.IntraproceduralInfer) {
        for (int s = 0; s < this.Summary.Count; s++) {
          ProcedureSummaryEntry/*!*/ entry = cce.NonNull(this.Summary[s]);
          stream.Write(level + 1, "// ");
          stream.WriteLine();
        }
      }

      stream.WriteLine();
      stream.WriteLine();
    }
Пример #18
0
 protected void EmitAttributes(TokenTextWriter stream) {
   Contract.Requires(stream != null);
   for (QKeyValue kv = this.Attributes; kv != null; kv = kv.Next) {
     kv.Emit(stream);
     stream.Write(" ");
   }
 }
Пример #19
0
 public static void Emit(this List<TypeVariable> tvs, TokenTextWriter stream, string separator) {
   Contract.Requires(separator != null);
   Contract.Requires(stream != null);
   string sep = "";
   foreach (TypeVariable/*!*/ v in tvs) {
     Contract.Assert(v != null);
     stream.Write(sep);
     sep = separator;
     v.Emit(stream);
   }
 }
Пример #20
0
 public static void Emit(this List<Variable> vs, TokenTextWriter stream, bool emitAttributes) {
   Contract.Requires(stream != null);
   string sep = "";
   foreach (Variable/*!*/ v in vs) {
     Contract.Assert(v != null);
     stream.Write(sep);
     sep = ", ";
     v.EmitVitals(stream, 0, emitAttributes);
   }
 }
Пример #21
0
    public static void Emit(this List<IdentifierExpr> ids, TokenTextWriter stream, bool printWhereComments) {
      Contract.Requires(stream != null);
      string sep = "";
      foreach (IdentifierExpr/*!*/ e in ids) {
        Contract.Assert(e != null);
        stream.Write(sep);
        sep = ", ";
        e.Emit(stream);

        if (printWhereComments && e.Decl != null && e.Decl.TypedIdent.WhereExpr != null) {
          stream.Write(" /* where ");
          e.Decl.TypedIdent.WhereExpr.Emit(stream);
          stream.Write(" */");
        }
      }
    }
Пример #22
0
 public static void Emit(this List<Expr> ts, TokenTextWriter stream) {
   Contract.Requires(stream != null);
   string sep = "";
   foreach (Expr/*!*/ e in ts) {
     Contract.Assert(e != null);
     stream.Write(sep);
     sep = ", ";
     e.Emit(stream);
   }
 }
Пример #23
0
 public static void Emit(this List<String> ss, TokenTextWriter stream) {
   Contract.Requires(stream != null);
   string sep = "";
   foreach (string/*!*/ s in ss) {
     Contract.Assert(s != null);
     stream.Write(sep);
     sep = ", ";
     stream.Write(s);
   }
 }
Пример #24
0
 public void Emit(TokenTextWriter stream) {
   Contract.Requires(stream != null);
   stream.SetToken(this);
   if (this.Name != NoName) {
     stream.Write("{0}: ", TokenTextWriter.SanitizeIdentifier(this.Name));
   }
   this.Type.Emit(stream);
   if (this.WhereExpr != null) {
     stream.Write(" where ");
     this.WhereExpr.Emit(stream);
   }
 }
Пример #25
0
        public override void Emit(TokenTextWriter stream, int level)
        {
            stream.Write(level, "while (");
              if (Guard == null) {
            stream.Write("*");
              } else {
            Guard.Emit(stream);
              }
              stream.WriteLine(")");

              foreach (PredicateCmd inv in Invariants) {
            if (inv is AssumeCmd) {
              stream.Write(level + 1, "free invariant ");
            } else {
              stream.Write(level + 1, "invariant ");
            }
            Cmd.EmitAttributes(stream, inv.Attributes);
            inv.Expr.Emit(stream);
            stream.WriteLine(";");
              }

              stream.WriteLine(level, "{");
              Body.Emit(stream, level + 1);
              stream.WriteLine(level, "}");
        }
Пример #26
0
 public void Emit(TokenTextWriter stream, int level) {
   Contract.Requires(stream != null);
   if (Comment != null) {
     stream.WriteLine(this, level, "// " + Comment);
   }
   stream.Write(this, level, "{0}ensures ", Free ? "free " : "");
   Cmd.EmitAttributes(stream, Attributes);
   this.Condition.Emit(stream);
   stream.WriteLine(";");
 }
Пример #27
0
 public override void Emit(TokenTextWriter stream, int level)
 {
     //Contract.Requires(stream != null);
       stream.Write(this, level, "assume ");
       EmitAttributes(stream, Attributes);
       this.Expr.Emit(stream);
       stream.WriteLine(";");
 }
Пример #28
0
 public override void Emit(TokenTextWriter stream, int level) {
   //Contract.Requires(stream != null);
   if (Comment != null) {
     stream.WriteLine(this, level, "// " + Comment);
   }
   stream.Write(this, level, "function ");
   EmitAttributes(stream);
   if (Body != null && !QKeyValue.FindBoolAttribute(Attributes, "inline")) {
     // Boogie inlines any function whose .Body field is non-null.  The parser populates the .Body field
     // is the :inline attribute is present, but if someone creates the Boogie file directly as an AST, then
     // the :inline attribute may not be there.  We'll make sure it's printed, so one can see that this means
     // that the body will be inlined.
     stream.Write("{:inline} ");
   }
   if (CommandLineOptions.Clo.PrintWithUniqueASTIds) {
     stream.Write("h{0}^^{1}", this.GetHashCode(), TokenTextWriter.SanitizeIdentifier(this.Name));
   } else {
     stream.Write("{0}", TokenTextWriter.SanitizeIdentifier(this.Name));
   }
   EmitSignature(stream, true);
   if (Body != null) {
     stream.WriteLine();
     stream.WriteLine("{");
     stream.Write(level + 1, "");
     Body.Emit(stream);
     stream.WriteLine();
     stream.WriteLine("}");
   } else {
     stream.WriteLine(";");
   }
 }
Пример #29
0
    protected void EmitSignature(TokenTextWriter stream, bool shortRet) {
      Contract.Requires(stream != null);
      Type.EmitOptionalTypeParams(stream, TypeParameters);
      stream.Write("(");
      InParams.Emit(stream, true);
      stream.Write(")");

      if (shortRet) {
        Contract.Assert(OutParams.Count == 1);
        stream.Write(" : ");
        cce.NonNull(OutParams[0]).TypedIdent.Type.Emit(stream);
      } else if (OutParams.Count > 0) {
        stream.Write(" returns (");
        OutParams.Emit(stream, true);
        stream.Write(")");
      }
    }
Пример #30
0
 /// <summary>
 /// This is a helper routine for printing a linked list of attributes.  Each attribute
 /// is terminated by a space.
 /// </summary>
 public static void EmitAttributes(TokenTextWriter stream, QKeyValue attributes)
 {
     Contract.Requires(stream != null);
       for (QKeyValue kv = attributes; kv != null; kv = kv.Next) {
     kv.Emit(stream);
     stream.Write(" ");
       }
 }
Пример #31
0
    public override void Emit(TokenTextWriter stream, int level) {
      //Contract.Requires(stream != null);
      stream.Write(this, level, "const ");
      EmitAttributes(stream);
      if (this.Unique) {
        stream.Write(this, level, "unique ");
      }
      EmitVitals(stream, level, false);

      if (Parents != null || ChildrenComplete) {
        stream.Write(this, level, " extends");
        string/*!*/ sep = " ";
        foreach (ConstantParent/*!*/ p in cce.NonNull(Parents)) {
          Contract.Assert(p != null);
          stream.Write(this, level, sep);
          sep = ", ";
          if (p.Unique)
            stream.Write(this, level, "unique ");
          p.Parent.Emit(stream);
        }
        if (ChildrenComplete)
          stream.Write(this, level, " complete");
      }

      stream.WriteLine(";");
    }
Пример #32
0
 public override void Emit(TokenTextWriter stream, int level) {
   //Contract.Requires(stream != null);
   stream.Write(this, level, "var ");
   EmitVitals(stream, level, true);
   stream.WriteLine(";");
 }
Пример #33
0
 public void EmitVitals(TokenTextWriter stream, int level, bool emitAttributes) {
   Contract.Requires(stream != null);
   if (emitAttributes) {
     EmitAttributes(stream);
   }
   if (CommandLineOptions.Clo.PrintWithUniqueASTIds && this.TypedIdent.HasName) {
     stream.Write("h{0}^^", this.GetHashCode());  // the idea is that this will prepend the name printed by TypedIdent.Emit
   }
   this.TypedIdent.Emit(stream);
 }
Пример #34
0
        public override void Emit(TokenTextWriter stream, int level)
        {
            stream.Write(level, "if (");
              IfCmd/*!*/ ifcmd = this;
              while (true) {
            if (ifcmd.Guard == null) {
              stream.Write("*");
            } else {
              ifcmd.Guard.Emit(stream);
            }
            stream.WriteLine(")");

            stream.WriteLine(level, "{");
            ifcmd.thn.Emit(stream, level + 1);
            stream.WriteLine(level, "}");

            if (ifcmd.elseIf != null) {
              stream.Write(level, "else if (");
              ifcmd = ifcmd.elseIf;
              continue;
            } else if (ifcmd.elseBlock != null) {
              stream.WriteLine(level, "else");
              stream.WriteLine(level, "{");
              ifcmd.elseBlock.Emit(stream, level + 1);
              stream.WriteLine(level, "}");
            }
            break;
              }
        }
Пример #35
0
 public void Emit(TokenTextWriter stream) {
   Contract.Requires(stream != null);
   stream.Write("{:");
   stream.Write(Key);
   string sep = " ";
   foreach (object p in Params) {
     stream.Write(sep);
     sep = ", ";
     if (p is string) {
       stream.Write("\"");
       stream.Write((string)p);
       stream.Write("\"");
     } else {
       ((Expr)p).Emit(stream);
     }
   }
   stream.Write("}");
 }
Пример #36
0
 public override void Emit(TokenTextWriter stream)
 {
     Map.Emit(stream);
       stream.Write("[");
       string/*!*/ sep = "";
       foreach (Expr/*!*/ e in Indexes) {
     Contract.Assert(e != null);
     stream.Write(sep);
     sep = ", ";
     e.Emit(stream);
       }
       stream.Write("]");
 }
Пример #37
0
 protected override void EmitTriggers(TokenTextWriter stream) {
   //Contract.Requires(stream != null);
   stream.push();
   for (Trigger tr = this.Triggers; tr != null; tr = tr.Next) {
     tr.Emit(stream);
     stream.Write(" ");
     stream.sep();
   }
   stream.pop();
 }
Пример #38
0
 public override void Emit(TokenTextWriter stream, int level)
 {
     //Contract.Requires(stream != null);
       stream.Write(this, level, "return ");
       this.Expr.Emit(stream);
       stream.WriteLine(";");
 }
Пример #39
0
 public override void Emit(TokenTextWriter stream, int level)
 {
     //Contract.Requires(stream != null);
       Contract.Assume(this.labelNames != null);
       stream.Write(this, level, "goto ");
       if (CommandLineOptions.Clo.PrintWithUniqueASTIds) {
     if (labelTargets == null) {
       string sep = "";
       foreach (string name in labelNames) {
     stream.Write("{0}{1}^^{2}", sep, "NoDecl", name);
     sep = ", ";
       }
     } else {
       string sep = "";
       foreach (Block/*!*/ b in labelTargets) {
     Contract.Assert(b != null);
     stream.Write("{0}h{1}^^{2}", sep, b.GetHashCode(), b.Label);
     sep = ", ";
       }
     }
       } else {
     labelNames.Emit(stream);
       }
       stream.WriteLine(";");
 }
Пример #40
0
    public override void Emit(TokenTextWriter stream, int level) {
      //Contract.Requires(stream != null);
      stream.Write(this, level, "implementation ");
      EmitAttributes(stream);
      stream.Write(this, level, "{0}", TokenTextWriter.SanitizeIdentifier(this.Name));
      EmitSignature(stream, false);
      stream.WriteLine();

      stream.WriteLine(level, "{0}", '{');

      foreach (Variable/*!*/ v in this.LocVars) {
        Contract.Assert(v != null);
        v.Emit(stream, level + 1);
      }

      if (this.StructuredStmts != null && !CommandLineOptions.Clo.PrintInstrumented && !CommandLineOptions.Clo.PrintInlined) {
        if (this.LocVars.Count > 0) {
          stream.WriteLine();
        }
        if (CommandLineOptions.Clo.PrintUnstructured < 2) {
          if (CommandLineOptions.Clo.PrintUnstructured == 1) {
            stream.WriteLine(this, level + 1, "/*** structured program:");
          }
          this.StructuredStmts.Emit(stream, level + 1);
          if (CommandLineOptions.Clo.PrintUnstructured == 1) {
            stream.WriteLine(level + 1, "**** end structured program */");
          }
        }
      }

      if (this.StructuredStmts == null || 1 <= CommandLineOptions.Clo.PrintUnstructured ||
          CommandLineOptions.Clo.PrintInstrumented || CommandLineOptions.Clo.PrintInlined) {
        foreach (Block b in this.Blocks) {
          b.Emit(stream, level + 1);
        }
      }

      stream.WriteLine(level, "{0}", '}');

      stream.WriteLine();
      stream.WriteLine();
    }
Пример #41
0
 public override void Emit(TokenTextWriter stream, int level)
 {
     //Contract.Requires(stream != null);
       stream.Write(this, level, "havoc ");
       Vars.Emit(stream, true);
       stream.WriteLine(";");
 }
Пример #42
0
 public override void Emit(TokenTextWriter stream, int level) {
   //Contract.Requires(stream != null);
   stream.Write(this, level, "type ");
   EmitAttributes(stream);
   stream.Write("{0}", TokenTextWriter.SanitizeIdentifier(Name));
   if (TypeParameters.Count > 0)
     stream.Write(" ");
   TypeParameters.Emit(stream, " ");
   stream.Write(" = ");
   Body.Emit(stream);
   stream.WriteLine(";");
 }