CClash.Compiler.InvokePreprocessor C# (CSharp) Method

InvokePreprocessor() public method

public InvokePreprocessor ( StreamWriter stdout ) : int
stdout System.IO.StreamWriter
return int
        public int InvokePreprocessor(StreamWriter stdout)
        {
            var xargs = new List<string>();
            xargs.Add("/EP");
            xargs.AddRange(from x in CommandLine where (x != "/c" || x != "-c") select x);
            return InvokeCompiler(xargs, (x) => { }, stdout.Write, false, null);
        }

Usage Example

Beispiel #1
0
        public void PreprocessorTest(params string[] argv)
        {
            var c = new Compiler() { CompilerExe = CompilerPath };
            c.SetWorkingDirectory(InitialDir);
            c.SetEnvironment(Compiler.GetEnvironmentDictionary());

            var supported = c.ProcessArguments(argv);
            
            Assert.IsTrue(supported);
            Assert.AreEqual(1, c.CliIncludePaths.Count);
            Assert.AreEqual( Path.Combine(InitialDir, "test-sources\\inc with spaces"), c.CliIncludePaths[0]);
            Assert.AreEqual( Path.Combine(InitialDir, "test-sources\\hello.c"), c.SingleSourceFile);
            using (var sw = new StreamWriter(new MemoryStream()))
            {
                var rv = c.InvokePreprocessor(sw);
                Assert.AreEqual(0, rv);
            }
        }