cpp.setListener(listener); for (Macro macro : macros) cpp.addMacro(macro.getName(), macro.getValue());
preprocessor.setListener(new PreprocessorListener() { @Override public void handleWarning(Source source, int line, int column,
preprocessor.setListener(new PreprocessorListener() { @Override public void handleWarning(Source source, int line, int column,
@Test public void testPragma() throws Exception { File file = new File("build/resources/test/pragma.c"); assertTrue(file.exists()); CharSource source = Files.asCharSource(file, Charsets.UTF_8); CppReader r = new CppReader(source.openBufferedStream()); r.getPreprocessor().setListener(new DefaultPreprocessorListener()); String output = CharStreams.toString(r); r.close(); LOG.info("Output: " + output); // assertTrue(output.contains("absolute-result")); } }
public List<String> run() throws SoShaderException { try { final SoShaderPreprocessorJCPP p = SoShaderPreprocessorJCPP.this; this.pp.setSystemIncludePath(p.modules); this.pp.setFileSystem(p.filesystem); this.pp.addInput(p.filesystem.getFile(this.file).getSource()); this.pp.setListener(this); this.setupDefines(); final int bsize = 2 << 14; try (final ByteArrayOutputStream bao = new ByteArrayOutputStream(bsize)) { this.processTokens(bao); return this.processLines(bao); } } catch (final IOException e) { throw new SoShaderExceptionIO(e); } }
pp.addFeature(Feature.LINEMARKERS); pp.addWarning(Warning.IMPORT); pp.setListener(new PreprocessorListener()); pp.addMacro("__JCPP__"); pp.getSystemIncludePath().add("/usr/local/include");
pp.addFeature(Feature.LINEMARKERS); pp.addWarning(Warning.IMPORT); pp.setListener(new PreprocessorListener()); pp.addMacro("__JCPP__"); pp.getSystemIncludePath().add("/usr/local/include");
pp.addFeature(Feature.LINEMARKERS); pp.addWarning(Warning.IMPORT); pp.setListener(new DefaultPreprocessorListener()); pp.addMacro("__JCPP__"); pp.getSystemIncludePath().add("/usr/local/include");
p.addInput(sl); pl = new DefaultPreprocessorListener(); p.setListener(pl); assertNotNull("CPP has listener", p.getListener()); assertTrue(testError(p));
p.addInput(sl); pl = new PreprocessorListener(); p.setListener(pl); assertNotNull("CPP has listener", p.getListener()); assertTrue(testError(p));