Package avrora.util

Examples of avrora.util.Printer


     * compiled to Java source and each compiled block is output to the console.
     * @param args the arguments from the command line to the DBBC test program
     * @throws Exception
     */
    public void run(String[] args) throws Exception {
        Printer printer = Printer.STDOUT;
        PrettyPrinter pp = new PrettyPrinter(printer);
        Program p = Main.loadProgram(args);
        DBBC dbbc = new DBBC(p, options);

        ControlFlowGraph cfg = p.getCFG();
        Iterator i = cfg.getSortedBlockIterator();
        while (i.hasNext()) {
            ControlFlowGraph.Block b = (ControlFlowGraph.Block)i.next();
            printer.startblock("block starting at: " + StringUtil.addrToString(b.getAddress()));
            DBBC.CodeBlock code = dbbc.getCodeBlock(b.getAddress());
            if (code != null) {
                printer.println("// worst case execution time = " + code.wcet + " cycles");
                pp.visitStmtList(code.stmts);
            } else {
                printer.println("// no code generated for this block");
            }
            printer.endblock();
        }
    }
View Full Code Here


        }
    }

    private Printer createPrinter(String name) {
        String fname = dname + File.separatorChar +name+".instr";
        Printer p = null;
        try {
            File file = new File(fname);
            p = new Printer(new PrintStream(new FileOutputStream(file)));
        } catch ( IOException e) {
            Avrora.userError("Cannot create test file", fname);
        }
        return p;
    }
View Full Code Here

        }
    }

    private void dumpDotCFG(ControlFlowGraph cfg) throws java.io.IOException {
        String fname;
        Printer p;
        if ("".equals(fname = FILE.get()))
            p = Printer.STDOUT;
        else
            p = new Printer(new PrintStream(new FileOutputStream(fname)));

        p.startblock("digraph G");

        if (COLOR_PROCEDURES.get() ||
                GROUP_PROCEDURES.get() ||
                COLLAPSE_PROCEDURES.get())
            pmap = cfg.getProcedureMap();

        dumpDotNodes(p);
        dumpDotEdges(p);
        p.endblock();
    }
View Full Code Here

            return;
        }
    }

    private Printer np(SectionFile f) {
        return new Printer(new PrintStream(f));
    }
View Full Code Here

TOP

Related Classes of avrora.util.Printer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.