diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-12-30 22:40:21 -0700 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-12-30 22:40:21 -0700 |
| commit | 8bcb83035607371a2326374665e9cc56c662a783 (patch) | |
| tree | b46c73e24edff0693f3e4c678bafad874ee9f21e /src/functiondisplay.cpp | |
| parent | ba7897ebadbc03d99200fda03a574a57b650e429 (diff) | |
| download | stage-8bcb83035607371a2326374665e9cc56c662a783.tar.gz stage-8bcb83035607371a2326374665e9cc56c662a783.tar.bz2 stage-8bcb83035607371a2326374665e9cc56c662a783.tar.xz stage-8bcb83035607371a2326374665e9cc56c662a783.zip | |
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.
Diffstat (limited to 'src/functiondisplay.cpp')
| -rw-r--r-- | src/functiondisplay.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
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() | |||
| 15 | 15 | ||
| 16 | void FunctionDisplay::call( class GameState &gState ) | 16 | void FunctionDisplay::call( class GameState &gState ) |
| 17 | { | 17 | { |
| 18 | Variable v = gState.popDeref(); | 18 | Bu::String s = gState.popDeref().to( Variable::tString ).getString(); |
| 19 | sio << "Display: " << v << sio.nl; | 19 | |
| 20 | sio << format( s ) << sio.nl; | ||
| 21 | // sio << "Display: " << v << sio.nl; | ||
| 22 | } | ||
| 23 | |||
| 24 | Bu::String FunctionDisplay::format( const Bu::String &sSrc ) | ||
| 25 | { | ||
| 26 | Bu::String sRet; | ||
| 27 | bool bWs = true; | ||
| 28 | Bu::String::const_iterator i = sSrc.begin(); | ||
| 29 | |||
| 30 | while( i ) | ||
| 31 | { | ||
| 32 | for(; i; i++ ) | ||
| 33 | { | ||
| 34 | if( *i != ' ' && *i != '\t' && *i != '\n' && *i != '\r' ) | ||
| 35 | break; | ||
| 36 | } | ||
| 37 | for(; i; i++ ) | ||
| 38 | { | ||
| 39 | if( i == ' ' || i == '\t' || *i == '\n' || *i == '\r' ) | ||
| 40 | { | ||
| 41 | sRet.append(' '); | ||
| 42 | break; | ||
| 43 | } | ||
| 44 | |||
| 45 | sRet.append( *i ); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | return sRet; | ||
| 20 | } | 50 | } |
| 21 | 51 | ||
