1 28 29 package org.objectweb.util.cpp.lib; 30 31 import java.io.File ; 32 import java.io.FileNotFoundException ; 33 import java.io.FileOutputStream ; 34 import java.io.IOException ; 35 import java.io.OutputStream ; 36 import java.util.Hashtable ; 37 import java.util.Vector ; 38 39 import org.objectweb.util.misc.api.ExceptionWrapper; 40 41 42 48 public class PreprocessorJPP 49 extends PreprocessorBase 50 { 51 57 63 64 public PreprocessorJPP() { 65 } 66 67 73 79 87 public boolean preprocess(String fileName, File tmpFile) { 88 FileOutputStream output = null; 89 try { 90 output = new FileOutputStream (tmpFile); 92 } catch(IOException exc) { 93 throw new ExceptionWrapper(exc); 95 } 96 97 boolean status = false; 98 try { 99 status = preprocess(fileName, output); 101 } finally { 102 IOHelper.close(output); 104 } 105 106 return status; 107 } 108 109 115 public boolean preprocess(String fileName, OutputStream output) { 116 try { 117 JPP jpp = new JPP(fileName, output, 119 ((Vector )includeDirectories_.clone()), 120 ((Hashtable )macros_.clone())); 121 return jpp.preprocess(); 123 } catch(FileNotFoundException exc) { 124 getConsole().error(fileName + ": No such file or directory"); 125 return false; 126 } catch(IOException exc) { 127 throw new ExceptionWrapper(exc); 128 } 129 } 130 } 131 | Popular Tags |