#include "functiondisplay.h" #include #include "gamestate.h" using namespace Bu; FunctionDisplay::FunctionDisplay() { } FunctionDisplay::~FunctionDisplay() { } void FunctionDisplay::call( class GameState &gState ) { Bu::String s = gState.popDeref().to( Variable::tString ).getString(); sio << format( s ) << sio.nl; /* 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; }