diff options
Diffstat (limited to 'src/minimacro.cpp')
-rw-r--r-- | src/minimacro.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/minimacro.cpp b/src/minimacro.cpp index df1a5c9..6c5a7c9 100644 --- a/src/minimacro.cpp +++ b/src/minimacro.cpp | |||
@@ -25,10 +25,10 @@ Bu::MiniMacro::~MiniMacro() | |||
25 | { | 25 | { |
26 | } | 26 | } |
27 | 27 | ||
28 | Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn ) | 28 | Bu::String Bu::MiniMacro::parse( const Bu::String &sIn ) |
29 | { | 29 | { |
30 | bContinue = true; | 30 | bContinue = true; |
31 | Bu::FString sOut; | 31 | Bu::String sOut; |
32 | for( sCur = sIn.getStr(); *sCur && bContinue; sCur++ ) | 32 | for( sCur = sIn.getStr(); *sCur && bContinue; sCur++ ) |
33 | { | 33 | { |
34 | if( *sCur == '{' ) | 34 | if( *sCur == '{' ) |
@@ -66,16 +66,16 @@ Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn ) | |||
66 | return sOut; | 66 | return sOut; |
67 | } | 67 | } |
68 | 68 | ||
69 | Bu::FString Bu::MiniMacro::parseRepl() | 69 | Bu::String Bu::MiniMacro::parseRepl() |
70 | { | 70 | { |
71 | Bu::FString sOut; | 71 | Bu::String sOut; |
72 | bool bIsFirst = true; | 72 | bool bIsFirst = true; |
73 | for( const char *sNext = sCur;;) | 73 | for( const char *sNext = sCur;;) |
74 | { | 74 | { |
75 | for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ ) { } | 75 | for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ ) { } |
76 | if( *sNext == '\0' ) | 76 | if( *sNext == '\0' ) |
77 | break; | 77 | break; |
78 | Bu::FString sName( sCur, (ptrdiff_t)sNext-(ptrdiff_t)sCur ); | 78 | Bu::String sName( sCur, (ptrdiff_t)sNext-(ptrdiff_t)sCur ); |
79 | if( bIsFirst ) | 79 | if( bIsFirst ) |
80 | { | 80 | { |
81 | sOut = hVars[sName]; | 81 | sOut = hVars[sName]; |
@@ -101,21 +101,21 @@ Bu::FString Bu::MiniMacro::parseRepl() | |||
101 | return sOut; | 101 | return sOut; |
102 | } | 102 | } |
103 | 103 | ||
104 | Bu::FString Bu::MiniMacro::parseCond() | 104 | Bu::String Bu::MiniMacro::parseCond() |
105 | { | 105 | { |
106 | Bu::FString sOut; | 106 | Bu::String sOut; |
107 | //printf("%20s\n", sCur ); | 107 | //printf("%20s\n", sCur ); |
108 | return sOut; | 108 | return sOut; |
109 | } | 109 | } |
110 | 110 | ||
111 | Bu::FString Bu::MiniMacro::parseCmd() | 111 | Bu::String Bu::MiniMacro::parseCmd() |
112 | { | 112 | { |
113 | Bu::FString sOut; | 113 | Bu::String sOut; |
114 | const char *sNext = sCur; | 114 | const char *sNext = sCur; |
115 | for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ ) { } | 115 | for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ ) { } |
116 | if( *sNext != '\0' ) | 116 | if( *sNext != '\0' ) |
117 | { | 117 | { |
118 | Bu::FString sName( sCur, (ptrdiff_t)sNext-(ptrdiff_t)sCur ); | 118 | Bu::String sName( sCur, (ptrdiff_t)sNext-(ptrdiff_t)sCur ); |
119 | if( sName == "end" ) | 119 | if( sName == "end" ) |
120 | { | 120 | { |
121 | sCur = sNext; | 121 | sCur = sNext; |
@@ -138,20 +138,20 @@ Bu::FString Bu::MiniMacro::parseCmd() | |||
138 | return sOut; | 138 | return sOut; |
139 | } | 139 | } |
140 | 140 | ||
141 | Bu::FString Bu::MiniMacro::callFunc( | 141 | Bu::String Bu::MiniMacro::callFunc( |
142 | const Bu::FString &sIn, const Bu::FString &sFunc ) | 142 | const Bu::String &sIn, const Bu::String &sFunc ) |
143 | { | 143 | { |
144 | int i = sFunc.findIdx('('); | 144 | int i = sFunc.findIdx('('); |
145 | if( i < 0 ) | 145 | if( i < 0 ) |
146 | throw Bu::ExceptionBase("That doesn't look like a function call"); | 146 | throw Bu::ExceptionBase("That doesn't look like a function call"); |
147 | Bu::FString sName( sFunc.getStr(), i ); | 147 | Bu::String sName( sFunc.getStr(), i ); |
148 | StrList lsParams; | 148 | StrList lsParams; |
149 | for( const char *s = sFunc.getStr()+i+1; *s && *s != ')'; s++ ) | 149 | for( const char *s = sFunc.getStr()+i+1; *s && *s != ')'; s++ ) |
150 | { | 150 | { |
151 | for(; *s == ' ' || *s == '\t' || *s == '\r' || *s == '\n'; s++ ) { } | 151 | for(; *s == ' ' || *s == '\t' || *s == '\r' || *s == '\n'; s++ ) { } |
152 | const char *sNext; | 152 | const char *sNext; |
153 | for( sNext = s; *sNext && *sNext != ')' && *sNext != ','; sNext++ ) { } | 153 | for( sNext = s; *sNext && *sNext != ')' && *sNext != ','; sNext++ ) { } |
154 | Bu::FString p( s, (ptrdiff_t)sNext-(ptrdiff_t)s ); | 154 | Bu::String p( s, (ptrdiff_t)sNext-(ptrdiff_t)s ); |
155 | lsParams.append( p ); | 155 | lsParams.append( p ); |
156 | sNext++; | 156 | sNext++; |
157 | s = sNext; | 157 | s = sNext; |
@@ -160,17 +160,17 @@ Bu::FString Bu::MiniMacro::callFunc( | |||
160 | } | 160 | } |
161 | 161 | ||
162 | void Bu::MiniMacro::addVar( | 162 | void Bu::MiniMacro::addVar( |
163 | const Bu::FString &sName, const Bu::FString &sValue ) | 163 | const Bu::String &sName, const Bu::String &sValue ) |
164 | { | 164 | { |
165 | hVars.insert( sName, sValue ); | 165 | hVars.insert( sName, sValue ); |
166 | } | 166 | } |
167 | 167 | ||
168 | bool Bu::MiniMacro::hasVar( const Bu::FString &sName ) | 168 | bool Bu::MiniMacro::hasVar( const Bu::String &sName ) |
169 | { | 169 | { |
170 | return hVars.has( sName ); | 170 | return hVars.has( sName ); |
171 | } | 171 | } |
172 | 172 | ||
173 | const Bu::FString &Bu::MiniMacro::getVar( const Bu::FString &sName ) | 173 | const Bu::String &Bu::MiniMacro::getVar( const Bu::String &sName ) |
174 | { | 174 | { |
175 | return hVars.get( sName ); | 175 | return hVars.get( sName ); |
176 | } | 176 | } |