//public static IEnumerable<string> PreprocessCode( // DirectoryInfo dirInfo, string fileSearchPattern, string workingDirectory = null) { // foreach (var fileInfo in dirInfo.GetFiles(fileSearchPattern, SearchOption.AllDirectories)) { // yield return ExternalProgramUtils.InvokeProcess( // string.Empty, "gcc", new[] { "-E", "-P", "-", fileInfo.FullName }, // workingDirectory ?? dirInfo.FullName); // } //} //public static string PreprocessCode(FileInfo fileInfo, string workingDirectory = null) { // return ExternalProgramUtils.InvokeProcess( // string.Empty, "gcc", new[] { "-E", "-P", "-", fileInfo.FullName }, // workingDirectory ?? fileInfo.DirectoryName); //} public static string PreprocessCode(string code, string workingDirectory) { var dirs = Directory.EnumerateDirectories( workingDirectory, "*", SearchOption.AllDirectories); var args = dirs.Select( dir => "-I/cygdrive/" + dir[0] + dir.Substring(2).Replace("\\", "/")) .Concat(new[] { "-E", "-P", "-" }); var code2 = ExternalProgramUtils.InvokeProcess(code, "gcc", args, workingDirectory); return(code2.Replace("int ((FILE *stream)->_file);", "")); }
public override void TryParseFromCodeText(string code) { using (var p = ExternalProgramUtils.StartProcess( code.Replace("\r\n", "\n"), ProcessorPath, ParserArguments)) {} }
protected override Process StartProcess(string code) { return(ExternalProgramUtils.StartProcess( code.Replace("\r\n", "\n"), ProcessorPath, XmlGeneratorArguments)); }
protected override ProcessStartInfo CreateProcessStartInfoForGeneratingCode() { return(ExternalProgramUtils.CreateProcessStartInfo( ProcessorPath, PrivateCodeGeneratorArguments)); }
protected override ProcessStartInfo CreateProcessStartInfoForGeneratingXml() { return(ExternalProgramUtils.CreateProcessStartInfo( _processorPath, XmlGeneratorArguments)); }