Class CodeUnit

  • Direct Known Subclasses:
    CCodeUnit, JavaCodeUnit

    public class CodeUnit
    extends Object
    General code unit (a generated C or Java source file), covering multiple FunctionEmitter allowing to unify output, decoration and dynamic helper code injection per unit.
    • Constructor Detail

      • CodeUnit

        protected CodeUnit​(String filename,
                           Object generator)
                    throws IOException
        filename - the class's full filename to open w/ write access
        generator - informal optional object that is creating this unit, used to be mentioned in a warning message if not null.
    • Method Detail

      • addTailCode

        public boolean addTailCode​(String c)
        Add a tail code to this unit
        c - the code to be added to the tail of this code unit
        true if the `tailCode` set did not already contain the specified code `c`
      • emitln

        public void emitln()
      • emitln

        public void emitln​(String s)
      • emit

        public void emit​(String s)
      • emitTailCode

        public void emitTailCode()
      • close

        public void close()