Context cx = new Context(statics);
cx.setLanguage(language);
cx.setPath(pathspec);
cx.setScriptName(scriptname);
ActionBlockEmitter emitter =
new ActionBlockEmitter(cx, scriptname,
new StringPrintWriter(),//code_out
new StringPrintWriter(),//header_out
show_instructions, show_machinecode,
show_linenums, emit_debug_info);
// ISSUE: does authoring need the output filename to be filename rather than scriptname?
cx.setEmitter(emitter); // retrieve emitter using cx.getEmitter();
cx.setHandler(handler);
cx.config_vars = configs;
// #if TRANSLATE_COMPOUND_NAMES
// // This is a test
// std::vector<String> compound_names;
// compound_names.push_back("Foo.bar");
// cx.setCompoundNames(compound_names);
// #endif // USE_COMPOUND_NAMES
// Build the global object
Builder globalBuilder = new GlobalBuilder();
ObjectValue global = new ObjectValue(cx, globalBuilder, null);
// Compiler something
compile(cx, global, in, filename, encoding, includes, swf_options, avmplus_exe, plugs, emit_doc_info, show_parsetrees, show_bytes,
show_flow, lint_mode, emit_metadata, save_comment_nodes, emit_debug_info, import_filespecs);
int error_count = status(cx);
if (error_count == 1)
{
System.err.println();
System.err.println("1 error found");
}
else if (error_count > 1)
{
System.err.println();
System.err.println(error_count + " errors found");
}
else if (show_parsetrees == false && emit_doc_info == false)
{
if (show_instructions)
{
printIL(cx, scriptname, emitter);
}
if (error_count == 0 && !show_parsetrees)
{
ByteList bytes = new ByteList();
emitter.emit(bytes); // Emit it
if (bytes.size() != 0)
{
if( optimize )
{
bytes = Optimizer.optimize(bytes);