#include "functiondisplay.h" #include "smlnode.h" #include #include "gamestate.h" #include "interface.h" using namespace Bu; FunctionDisplay::FunctionDisplay() { } FunctionDisplay::~FunctionDisplay() { } void FunctionDisplay::call( class GameState &gState ) { Bu::String s = gState.popDeref().to( Variable::tString ).getString(); SmlNode *pNode = SmlNode::parse( s ); gState.getInterface()->display( pNode ); delete pNode; gState.push( Variable( Variable::tNull ) ); /* Variable v = gState.popDeref(); sio << "Display: " << v << sio.nl; */ } Bu::String FunctionDisplay::format( const Bu::String &sSrc ) { Bu::String sRet; bool bWs = true; Bu::String::const_iterator i = sSrc.begin(); while( i ) { for(; i; i++ ) { if( *i != ' ' && *i != '\t' && *i != '\n' && *i != '\r' ) break; } for(; i; i++ ) { if( i == ' ' || i == '\t' || *i == '\n' || *i == '\r' ) { sRet.append(' '); break; } sRet.append( *i ); } } return sRet; }