public override void PrintTo(ICodePrinter printer, ILogPrinter logPrinter, PrintFlags flags) { Debug.Assert(printer != null && logPrinter != null && signature != null); if (hasForwardDeclaration) { printer.Print(OutputType.Keyword, "struct"); printer.Print(OutputType.Other, " "); printer.PrintLn(OutputType.Identifier, Name); printer.Indent(); printer.PrintLn(OutputType.Operator, "{"); // will print "ret_type (call_conv *ptr)(params)" signature.PrintTo(printer, logPrinter, flags); printer.Unindent(); printer.PrintLn(); printer.Print(OutputType.Operator, "};"); } else { printer.Print(OutputType.Keyword, "typedef"); printer.Print(OutputType.Other, " "); // will print "ret_type (call_conv *name)(params)" signature.PrintTo(printer, logPrinter, flags); } }
private static void PrintNativeSignature(NativeSignature nativeSig) { PrintFlags p_flags = PrintFlags.None; if (options.UsePlainCDataTypes) { p_flags |= PrintFlags.UsePlainC; } if (options.PrintMarshalDirection) { p_flags |= PrintFlags.PrintMarshalDirection; } LogMemoryPrinter log_mem_printer = new LogMemoryPrinter(); // print definitions first if (!options.SuppressTypeDefinitions) { foreach (NativeTypeDefinition def in nativeSig.GetDefinitions()) { def.PrintTo(codePrinter, log_mem_printer, p_flags); codePrinter.PrintLn(); codePrinter.PrintLn(); } } // and then the method signature nativeSig.PrintTo(codePrinter, log_mem_printer, p_flags); codePrinter.PrintLn(); codePrinter.PrintLn(); // flush the log_mem_printer to the real log printer if (!options.SuppressMessages) { log_mem_printer.ReplayTo(logPrinter); logPrinter.Separate(); } }
private static void PrintNativeSignature(NativeSignature nativeSig) { PrintFlags p_flags = PrintFlags.None; if (options.UsePlainCDataTypes) p_flags |= PrintFlags.UsePlainC; if (options.PrintMarshalDirection) p_flags |= PrintFlags.PrintMarshalDirection; var log_mem_printer = new LogMemoryPrinter(); // print definitions first if (!options.SuppressTypeDefinitions) { foreach (NativeTypeDefinition def in nativeSig.GetDefinitions()) { def.PrintTo(codePrinter, log_mem_printer, p_flags); codePrinter.PrintLn(); codePrinter.PrintLn(); } } // and then the method signature nativeSig.PrintTo(codePrinter, log_mem_printer, p_flags); codePrinter.PrintLn(); codePrinter.PrintLn(); // flush the log_mem_printer to the real log printer if (!options.SuppressMessages) { log_mem_printer.ReplayTo(logPrinter); logPrinter.Separate(); } }