From 8bcb83035607371a2326374665e9cc56c662a783 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 30 Dec 2011 22:40:21 -0700 Subject: Wow, dictionaries, nested dictionaries, for loops They all work. I still think I should change the lists to arrays in the backend so they can be indexed as well as iterated over and appended to. --- src/functiondisplay.cpp | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'src/functiondisplay.cpp') diff --git a/src/functiondisplay.cpp b/src/functiondisplay.cpp index fa5b79c..4790844 100644 --- a/src/functiondisplay.cpp +++ b/src/functiondisplay.cpp @@ -15,7 +15,37 @@ FunctionDisplay::~FunctionDisplay() void FunctionDisplay::call( class GameState &gState ) { - Variable v = gState.popDeref(); - sio << "Display: " << v << sio.nl; + Bu::String s = gState.popDeref().to( Variable::tString ).getString(); + + sio << format( s ) << sio.nl; +// 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; } -- cgit v1.2.3