/* ************************************************************************
#
#  DivConq
#
#  http://divconq.com/
#
#  Copyright:
#    Copyright 2012 eTimeline, LLC. All rights reserved.
#
#  License:
#    See the license.txt file in the project's top-level directory for details.
#
#  Authors:
#    * Andy White
#
************************************************************************ */
package divconq.script.inst;

import divconq.script.ExecuteState;
import divconq.script.IInstructionCallback;
import divconq.script.Instruction;
import divconq.script.StackEntry;
import divconq.struct.Struct;

public class Info extends Instruction {
	@Override
	public void run(final StackEntry stack, IInstructionCallback cb) {
		Struct ov = stack.resolveValue(this.source.getText(), "String");
		String output = (ov != null) ? ov.toString() : null;
		
		// TODO resolve how to do locale tokens for all logger functions
		stack.log().info(stack.intFromSource("Code", 0), output);
		
		System.out.println(output);
		stack.setState(ExecuteState.Done);
		
		cb.resume();
	}
}
