private void processFile( MetaDataGenerator generator, string file ) { Console.WriteLine("processing file: " + file); Trace.WriteLine(""); MemoryStream source = Preprocess( file ); // preprocess the file IDLParser parser = new IDLParser(source); Trace.WriteLine("parsing file: " + file ); ASTspecification spec = parser.specification(); Trace.WriteLine(parser.getSymbolTable()); // now parsed representation can be visited with the visitors generator.InitalizeForSource(parser.getSymbolTable()); spec.jjtAccept(generator, null); Trace.WriteLine(""); }
protected Assembly CreateIdl(Stream source, AssemblyName targetName, bool anyToAnyContainerMapping, bool makeInterfaceDisposable, ArrayList refAssemblies) { IDLParser parser = new IDLParser(source); ASTspecification spec = parser.specification(); // now parsed representation can be visited with the visitors MetaDataGenerator generator = new MetaDataGenerator(targetName, ".", refAssemblies); generator.MapAnyToAnyContainer = anyToAnyContainerMapping; if (makeInterfaceDisposable) { generator.InheritedInterface = typeof(System.IDisposable); } generator.InitalizeForSource(parser.getSymbolTable()); spec.jjtAccept(generator, null); Assembly result = generator.ResultAssembly; return result; }
public void MapIdl() { MetaDataGenerator generator = new MetaDataGenerator(GetAssemblyName(), m_commandLine.OutputDirectory.FullName, m_commandLine.ReferencedAssemblies); if (m_commandLine.GenerateValueTypeSkeletons) { generator.EnableValueTypeSkeletonGeneration(m_vtSkelcodeDomProvider, m_commandLine.ValueTypeSkeletonsTargetDir, m_commandLine.OverwriteValueTypeSkeletons); } generator.MapAnyToAnyContainer = m_commandLine.MapAnyToAnyContainer; if (m_commandLine.BaseInterface != null) { generator.InheritedInterface = m_commandLine.BaseInterface; } string currentDir = Directory.GetCurrentDirectory(); for (int i = 0; i < m_commandLine.InputFileNames.Count; i++) { Debug.WriteLine("checking file: " + m_commandLine.InputFileNames[i] ); string rootedPath = (string)m_commandLine.InputFileNames[i]; if (!Path.IsPathRooted((string)m_commandLine.InputFileNames[i])) { rootedPath = Path.Combine(currentDir, (string)m_commandLine.InputFileNames[i]); } string searchDirectory = Path.GetDirectoryName(rootedPath); string fileName = Path.GetFileName(rootedPath); string[] expandedFiles = Directory.GetFileSystemEntries(searchDirectory, fileName); if (expandedFiles.Length > 0) { foreach (string file in expandedFiles) { processFile(generator, file); } } else { Error("file(s) not found: " + m_commandLine.InputFileNames[i]); } } // save the result to disk generator.SaveAssembly(); }