< prev index next >

src/jdk.jextract/share/classes/com/sun/tools/jextract/HeaderFile.java

Print this page




  47     final Logger logger = Logger.getLogger(getClass().getPackage().getName());
  48 
  49     HeaderFile(Path path, String pkgName, String clsName, HeaderFile main) {
  50         this.path = path;
  51         this.pkgName = pkgName;
  52         this.clsName = clsName;
  53         dict = TypeDictionary.of(pkgName);
  54         serialNo = new AtomicInteger();
  55         this.main = main == null ? this : main;
  56     }
  57 
  58     /**
  59      * Call this function to enable code generation for this HeaderFile.
  60      * This function should only be called once to turn on code generation and before process any cursor.
  61      * @param cf The CodeFactory used to generate code
  62      */
  63     void useCodeFactory(CodeFactory cf) {
  64         if (null != this.cf) {
  65             logger.config(() -> "CodeFactory had been initialized for " + path);
  66             // Diagnosis code
  67             new Throwable().printStackTrace(System.out);


  68         } else {
  69             this.cf = cf;
  70         }
  71     }
  72 
  73     @Override
  74     public String toString() {
  75         return "HeaderFile(path=" + path + ")";
  76     }
  77 
  78     private int serialNo() {
  79         return serialNo.incrementAndGet();
  80     }
  81 
  82     void processCursor(Cursor c, HeaderFile main, boolean isBuiltIn) {
  83         if (c.isDeclaration()) {
  84             Type t = c.type();
  85             JType jt = dict.computeIfAbsent(t, type -> {
  86                 logger.fine(() -> "PH: Compute type for " + type.spelling());
  87                 return define(type);




  47     final Logger logger = Logger.getLogger(getClass().getPackage().getName());
  48 
  49     HeaderFile(Path path, String pkgName, String clsName, HeaderFile main) {
  50         this.path = path;
  51         this.pkgName = pkgName;
  52         this.clsName = clsName;
  53         dict = TypeDictionary.of(pkgName);
  54         serialNo = new AtomicInteger();
  55         this.main = main == null ? this : main;
  56     }
  57 
  58     /**
  59      * Call this function to enable code generation for this HeaderFile.
  60      * This function should only be called once to turn on code generation and before process any cursor.
  61      * @param cf The CodeFactory used to generate code
  62      */
  63     void useCodeFactory(CodeFactory cf) {
  64         if (null != this.cf) {
  65             logger.config(() -> "CodeFactory had been initialized for " + path);
  66             // Diagnosis code
  67             if (Main.DEBUG) {
  68                 new Throwable().printStackTrace(System.err);
  69             }
  70         } else {
  71             this.cf = cf;
  72         }
  73     }
  74 
  75     @Override
  76     public String toString() {
  77         return "HeaderFile(path=" + path + ")";
  78     }
  79 
  80     private int serialNo() {
  81         return serialNo.incrementAndGet();
  82     }
  83 
  84     void processCursor(Cursor c, HeaderFile main, boolean isBuiltIn) {
  85         if (c.isDeclaration()) {
  86             Type t = c.type();
  87             JType jt = dict.computeIfAbsent(t, type -> {
  88                 logger.fine(() -> "PH: Compute type for " + type.spelling());
  89                 return define(type);


< prev index next >