private void print(String what, ASTNode where) { String addr = StringUtil.addrToString(segment.getCurrentAddress()); modulePrinter.println( segment.getName() + " @ " + addr + ": " + what + " on line " + where.getLeftMostToken().beginLine); }
// .include directive public void includeFile(AbstractToken fname) throws AbstractParseException { try { modulePrinter.println("includeFile(" + fname.image + ')'); String fn = StringUtil.trimquotes(fname.image); AtmelParser parser = new AtmelParser(new FileInputStream(fn), this, fn); // TODO: handle infinite include recursion possibility parser.Module(); } catch (FileNotFoundException e) { ERROR.IncludeFileNotFound(fname); } }
// .byte directive public void reserveBytes(Expr e, Expr f) { // TODO: fill section with particular value int result = e.evaluate(segment.getCurrentAddress(), this); modulePrinter.println("reserveBytes(" + e + ") -> " + result); addItem(new Item.UninitializedData(segment, result)); }
// .org directive public void setOrigin(Expr.Constant c) { int result = c.evaluate(segment.getCurrentAddress(), this); modulePrinter.println("setOrigin(" + c + ") -> " + result); segment.setOrigin(result); }
// .eseg directive public void enterEEPROMSegment() { modulePrinter.println("enter segment: eeprom"); segment = eepromSegment; }
// .cseg directive public void enterProgramSegment() { modulePrinter.println("enter segment: program"); segment = programSegment; }
// .dseg directive public void enterDataSegment() { modulePrinter.println("enter segment: data"); segment = dataSegment; }
// .equ directive public void addConstant(AbstractToken name, Expr val) { modulePrinter.println(".equ " + labelName(name) + " = " + val); addItem(new Item.NamedConstant(segment, name, val)); }
// .def directive public void addDefinition(AbstractToken name, AbstractToken rtok) { modulePrinter.println(".def " + labelName(name) + " = " + labelName(rtok)); addItem(new Item.RegisterAlias(segment, name, rtok)); }