Ejemplo n.º 1
0
        //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);", ""));
        }
Ejemplo n.º 2
0
 public override void TryParseFromCodeText(string code)
 {
     using (var p = ExternalProgramUtils.StartProcess(
                code.Replace("\r\n", "\n"), ProcessorPath, ParserArguments)) {}
 }
Ejemplo n.º 3
0
 protected override Process StartProcess(string code)
 {
     return(ExternalProgramUtils.StartProcess(
                code.Replace("\r\n", "\n"), ProcessorPath, XmlGeneratorArguments));
 }
Ejemplo n.º 4
0
 protected override ProcessStartInfo CreateProcessStartInfoForGeneratingCode()
 {
     return(ExternalProgramUtils.CreateProcessStartInfo(
                ProcessorPath, PrivateCodeGeneratorArguments));
 }
Ejemplo n.º 5
0
 protected override ProcessStartInfo CreateProcessStartInfoForGeneratingXml()
 {
     return(ExternalProgramUtils.CreateProcessStartInfo(
                _processorPath, XmlGeneratorArguments));
 }