Наследование: System.IO.StreamWriter
Пример #1
0
 internal virtual void Write(CILWriter output)
 {
 }
Пример #2
0
 internal override void Write(CILWriter output)
 {
     if (twoByteInstr) {
         output.WriteLine(FEopcode[instr]);
     } else {
         output.WriteLine(opcode[instr]);
     }
 }
Пример #3
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine(opcode[instr] + " " + val);
 }
Пример #4
0
 internal override void BuildCILInfo(CILWriter output)
 {
     parent.BuildCILInfo(output);
 }
Пример #5
0
 internal override void BuildCILInfo(CILWriter output)
 {
     for (int i = 0; i < constraints.Count; i++) {
         Class cClass = (Class)constraints[i];
         if (!cClass.isDef()) {
             cClass.BuildCILInfo(output);
         }
     }
 }
Пример #6
0
 internal override sealed void BuildCILInfo(CILWriter output)
 {
     if (!type.isDef()) type.BuildCILInfo(output);
 }
Пример #7
0
 internal override void BuildCILInfo(CILWriter output)
 {
     if (field == null) throw new InstructionException(IType.fieldOp,instr);
     if (field is FieldRef) field.BuildCILInfo(output);
 }
Пример #8
0
        internal override void Write(CILWriter output)
        {
            output.Write(".class ");
            WriteFlags(output);
            if ((nameSpace != null) && (nameSpace != "")) {
                output.Write(nameSpace + ".");
            }
            output.WriteLine(name);
            if (superType != null) {
                output.Write("    extends ");
                superType.WriteName(output);
            }
            if (interfaces.Count > 0) {
                output.Write("  implements ");
                for (int i=0; i < interfaces.Count; i++) {
                    InterfaceImpl impl = (InterfaceImpl)interfaces[i];
                    if (i > 0) output.Write(", ");
                    impl.TheInterface().WriteName(output);
                }
            }
            output.WriteLine();
            output.WriteLine("{");
            for (int i=0; i < fields.Count; i++) {
                ((Field)fields[i]).Write(output);
                output.WriteLine();
            }
            for (int i=0; i < methods.Count; i++) {
                ((MethodDef)methods[i]).Write(output);
                output.WriteLine();
            }
            for (int i=0; i < methodImpls.Count; i++) {
                ((MethodImpl)methodImpls[i]).Write(output);
                output.WriteLine();
            }
            for (int i=0; i < events.Count; i++) {
                ((Event)events[i]).Write(output);
                output.WriteLine();
            }
            for (int i=0; i < properties.Count; i++) {
                ((Property)properties[i]).Write(output);
                output.WriteLine();
            }

            output.WriteLine("}");
            output.WriteLine();
        }
Пример #9
0
 internal override void WriteName(CILWriter output)
 {
     if ((nameSpace == null) || (nameSpace == "")) {
         output.Write(name);
     } else {
         output.Write(nameSpace + "." + name);
     }
 }
Пример #10
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine("Label" + num + ":");
 }
Пример #11
0
 internal override void BuildCILInfo(CILWriter output)
 {
     if ((superType != null) && !(superType is ClassDef)) {
         superType.BuildCILInfo(output);
     }
     for (int i = 0; i < genericParams.Count; i++) {
         ((GenericParam)genericParams[i]).BuildCILInfo(output);
     }
     if (security != null) {
         for (int i = 0; i < security.Count; i++) {
             ((DeclSecurity)security[i]).BuildCILInfo(output);
         }
     }
     // Console.WriteLine("Building CIL info for " + name);
     // Console.WriteLine("adding methods " + methods.Count);
     for (int i = 0; i < methods.Count; i++) {
         ((MethodDef)methods[i]).BuildCILInfo(output);
     }
     // Console.WriteLine("adding fields");
     for (int i = 0; i < fields.Count; i++) {
         ((FieldDef)fields[i]).BuildCILInfo(output);
     }
     // Console.WriteLine("adding interfaceimpls and methodimpls");
     if (interfaces.Count > 0) {
         for (int i = 0; i < interfaces.Count; i++) {
             ((InterfaceImpl)interfaces[i]).BuildCILInfo(output);
         }
     }
     if (methodImpls.Count > 0) {
         for (int i = 0; i < methodImpls.Count; i++) {
             ((MethodImpl)methodImpls[i]).BuildCILInfo(output);
         }
     }
     for (int i = 0; i < events.Count; i++) {
         ((Event)events[i]).BuildCILInfo(output);
     }
     for (int i = 0; i < properties.Count; i++) {
         ((Property)properties[i]).BuildCILInfo(output);
     }
     // Console.WriteLine("Adding nested classes");
     for (int i = 0; i < nestedClasses.Count; i++) {
         ((ClassDef)nestedClasses[i]).BuildCILInfo(output);
     }
     // Console.WriteLine("End of building tables");
 }
Пример #12
0
 internal override void BuildCILInfo(CILWriter output)
 {
     if (num == -1) {
         num = labelNum++;
     }
 }
Пример #13
0
 internal void Write(CILWriter output)
 {
     for (int i=0; i < tide; i++) {
         if (!(buffer[i] is CILLabel)) {
             output.Write("    ");
         }
         output.Write("    ");
         buffer[i].Write(output);
     }
     if (exceptions != null) {
         throw new NotYetImplementedException("Exceptions not yet implemented for CIL Instructions");
         // Console.WriteLine("Writing exceptions");
         // Console.WriteLine("header = " + Hex.Short(exceptHeader) + " exceptSize = " + Hex.Int(exceptSize));
         //output.Write(exceptHeader);
         //output.Write3Bytes((uint)exceptSize);
         //for (int i = 0; i < exceptions.Count; i++) {
         //     TryBlock tryBlock = (TryBlock)exceptions[i];
         //    tryBlock.Write(output, fatExceptionFormat);
         //}
     }
 }
Пример #14
0
 internal void BuildCILInfo(CILWriter output)
 {
     for (int i=0; i < tide; i++) {
         buffer[i].BuildCILInfo(output);
     }
     if (exceptions != null) {
         for (int i=0; i < exceptions.Count; i++) {
             ((TryBlock)exceptions[i]).BuildCILInfo(output);
         }
     }
 }
Пример #15
0
 internal override void Write(CILWriter output)
 {
     throw new NotYetImplementedException("Write CIL for event");
 }
Пример #16
0
 internal override void WriteType(CILWriter output)
 {
     output.Write("class ");
     WriteName(output);
 }
Пример #17
0
 internal override void WriteType(CILWriter output)
 {
     type.WriteType(output);
     output.Write(" ");
     parent.WriteName(output);
     output.Write("::" + name);
 }
Пример #18
0
 private void WriteFlags(CILWriter output)
 {
     uint vis = flags & VisibilityMask;
     switch (vis) {
         case 0 : output.Write("private "); break;
         case 1 : output.Write("public "); break;
         case 2 : output.Write("nested public "); break;
         case 3 : output.Write("nested private "); break;
         case 4 : output.Write("nested family "); break;
         case 5 : output.Write("nested assembly "); break;
         case 6 : output.Write("nested famandassem "); break;
         case 7 : output.Write("nested famorassem "); break;
     }
     uint layout = flags & LayoutMask;
     if (layout == 0) {
         output.Write("auto ");
     } else if (layout == (uint)TypeAttr.ExplicitLayout) {
         output.Write("explicit ");
     } else {
         output.Write("sequential ");
     }
     if ((flags & (uint)TypeAttr.Interface) != 0) {
         output.Write("interface ");
     }
     if ((flags & (uint)TypeAttr.Abstract) != 0) {
         output.Write("abstract ");
     } else if ((flags & (uint)TypeAttr.Sealed) != 0) {
         output.Write("sealed ");
     }
     uint strForm = flags & StringFormatMask;
     if (strForm == 0) {
         output.Write("ansi ");
     } else if (strForm == (uint)TypeAttr.UnicodeClass) {
         output.Write("unicode ");
     } else {
         output.Write("autochar ");
     }
     if ((flags & (uint)TypeAttr.BeforeFieldInit) != 0) {
         output.Write("beforefieldinit ");
     }
     if ((flags & (uint)TypeAttr.Serializable) != 0) {
         output.Write("serializable ");
     }
     if ((flags & (uint)TypeAttr.SpecialName) != 0) {
         output.Write("specialname ");
     }
     if ((flags & (uint)TypeAttr.RTSpecialName) != 0) {
         output.Write("rtsspecialname ");
     }
 }
Пример #19
0
 internal override void Write(CILWriter output)
 {
     output.Write("  .field ");
     if (hasOffset) {
         output.Write("[ {0} ] ", offset);
     }
     WriteFlags(output, flags);
     if (marshalType != null) {
         output.Write("marshal ");
         marshalType.Write(output);
     }
     type.WriteType(output);
     output.Write(" " + name);
     if (initVal != null) {
         initVal.Write(output);
     } else if (constVal != null) {
         constVal.Write(output);
     }
     output.WriteLine();
 }
Пример #20
0
 internal override sealed void BuildCILInfo(CILWriter output)
 {
     if (!(elemType is ClassDef))
         elemType.BuildCILInfo(output);
 }
Пример #21
0
 internal override void Write(CILWriter output)
 {
     output.Write(GetInstrString());
     field.WriteType(output);
     output.WriteLine();
 }
Пример #22
0
 internal override void BuildCILInfo(CILWriter output)
 {
     if (!special && scope != null) {
         output.AddRef(scope);
     }
 }
Пример #23
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine("ldc.r4 " + fVal);
 }
Пример #24
0
 internal override void WriteType(CILWriter output)
 {
     if ((nameSpace == null) || (nameSpace == "")) {
         output.Write("[" + scope.Name() +"]" + name);
     } else {
         output.Write("[" + scope.Name() +"]" + nameSpace + "." + name);
     }
 }
Пример #25
0
 internal virtual void BuildCILInfo(CILWriter output)
 {
 }
Пример #26
0
 internal virtual void Write(CILWriter output)
 {
     throw new NotYetImplementedException("Constant values for CIL");
 }
Пример #27
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine(".assembly " + name + " { }");
 }
Пример #28
0
 internal override void BuildCILInfo(CILWriter output)
 {
     eventType.BuildCILInfo(output);
 }
Пример #29
0
 /// <summary>
 /// Write out a line instruction to the CIL file.
 /// </summary>
 /// <param name="output">The CIL instruction writer to use to write this instruction.</param>
 internal override void Write(CILWriter output)
 {
     if (output.Debug) {
         string lineDetails = startLine + ", " + startCol;
         if (hasEnd) {
             lineDetails += ", " + endLine + ", " + endCol;
             if (sourceFile != null) {
                 lineDetails += ", " + sourceFile.Name;
             }
         }
         output.WriteLine(".line " + lineDetails);
     }
 }
Пример #30
0
 internal override void Write(CILWriter output)
 {
     output.WriteLine(".emitbyte " + Hex.Byte(byteVal));  // ???? CHECK THIS ????
 }