aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 02:14:08 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 02:14:08 +0000
commitf5aca1a1b402bd7ebc944dc6e6fe65828d863365 (patch)
tree4a0fdd8e166d5c4b03543279d332b9a858ef62df /src/tools
parent10c557562e1d67c55314c212371ea9cb7f802863 (diff)
downloadlibbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.gz
libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.bz2
libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.xz
libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.zip
Bu::FString is now String, and there's a shell script to fix any other programs
that were using fstring, I hope.
Diffstat (limited to '')
-rw-r--r--src/tools/bnfcompile.cpp26
-rw-r--r--src/tools/mkunit.cpp34
-rw-r--r--src/tools/myriad.cpp6
-rw-r--r--src/tools/parser.cpp2
-rw-r--r--src/tools/viewcsv.cpp10
5 files changed, 39 insertions, 39 deletions
diff --git a/src/tools/bnfcompile.cpp b/src/tools/bnfcompile.cpp
index 16e75a5..b7b363c 100644
--- a/src/tools/bnfcompile.cpp
+++ b/src/tools/bnfcompile.cpp
@@ -123,7 +123,7 @@ public:
123 } 123 }
124 } 124 }
125 125
126 virtual FString tokenToString( const Token &t ) 126 virtual String tokenToString( const Token &t )
127 { 127 {
128 switch( (TokenType)t.iToken ) 128 switch( (TokenType)t.iToken )
129 { 129 {
@@ -146,7 +146,7 @@ public:
146private: 146private:
147 Stream &rSrc; 147 Stream &rSrc;
148 QueueBuf qbIn; 148 QueueBuf qbIn;
149 FString sBuf; 149 String sBuf;
150}; 150};
151 151
152class BnfParser 152class BnfParser
@@ -201,9 +201,9 @@ private:
201 next(); 201 next();
202 if( pCur->iToken == tokIdentifier ) 202 if( pCur->iToken == tokIdentifier )
203 { 203 {
204 hTokens.insert( pCur->vExtra.get<Bu::FString>(), ++iLastToken ); 204 hTokens.insert( pCur->vExtra.get<Bu::String>(), ++iLastToken );
205 sio << "Added token[" << iLastToken << "]: " 205 sio << "Added token[" << iLastToken << "]: "
206 << pCur->vExtra.get<Bu::FString>() << sio.nl; 206 << pCur->vExtra.get<Bu::String>() << sio.nl;
207 } 207 }
208 else if( pCur->iToken == tokSemiColon ) 208 else if( pCur->iToken == tokSemiColon )
209 break; 209 break;
@@ -214,7 +214,7 @@ private:
214 214
215 void nonTerminal() 215 void nonTerminal()
216 { 216 {
217 Bu::FString sNtName = pCur->vExtra.get<Bu::FString>(); 217 Bu::String sNtName = pCur->vExtra.get<Bu::String>();
218 Parser::NonTerminal nt; 218 Parser::NonTerminal nt;
219 p.addNonTerminal( sNtName ); 219 p.addNonTerminal( sNtName );
220 sio.incIndent(); 220 sio.incIndent();
@@ -258,8 +258,8 @@ private:
258 { 258 {
259 case tokIdentifier: 259 case tokIdentifier:
260 { 260 {
261 const Bu::FString &sName = 261 const Bu::String &sName =
262 pCur->vExtra.get<Bu::FString>(); 262 pCur->vExtra.get<Bu::String>();
263 if( hTokens.has( sName ) ) 263 if( hTokens.has( sName ) )
264 { 264 {
265 pr.append( 265 pr.append(
@@ -292,8 +292,8 @@ private:
292 next(); 292 next();
293 if( pCur->iToken != tokIdentifier ) 293 if( pCur->iToken != tokIdentifier )
294 tokenError("tokIdentifier"); 294 tokenError("tokIdentifier");
295 Bu::FString sName = 295 Bu::String sName =
296 pCur->vExtra.get<Bu::FString>(); 296 pCur->vExtra.get<Bu::String>();
297 next(); 297 next();
298 if( pCur->iToken != tokCloseSquare ) 298 if( pCur->iToken != tokCloseSquare )
299 tokenError("tokCloseSquare"); 299 tokenError("tokCloseSquare");
@@ -317,8 +317,8 @@ private:
317 next(); 317 next();
318 if( pCur->iToken != tokIdentifier ) 318 if( pCur->iToken != tokIdentifier )
319 tokenError("tokIdentifier"); 319 tokenError("tokIdentifier");
320 Bu::FString sName = 320 Bu::String sName =
321 pCur->vExtra.get<Bu::FString>(); 321 pCur->vExtra.get<Bu::String>();
322 next(); 322 next();
323 if( pCur->iToken != tokCloseCurly ) 323 if( pCur->iToken != tokCloseCurly )
324 tokenError("tokCloseCurly"); 324 tokenError("tokCloseCurly");
@@ -366,14 +366,14 @@ private:
366 pCur = l.nextToken(); 366 pCur = l.nextToken();
367 } 367 }
368 368
369 void tokenError( const FString &s ) 369 void tokenError( const String &s )
370 { 370 {
371 throw ExceptionBase( ("Expected " + s + " but found " 371 throw ExceptionBase( ("Expected " + s + " but found "
372 + l.tokenToString( *pCur ) + ".").getStr() ); 372 + l.tokenToString( *pCur ) + ".").getStr() );
373 } 373 }
374 374
375private: 375private:
376 typedef Bu::Hash<Bu::FString, int> TokenHash; 376 typedef Bu::Hash<Bu::String, int> TokenHash;
377 TokenHash hTokens; 377 TokenHash hTokens;
378 BnfLexer &l; 378 BnfLexer &l;
379 BnfLexer::Token *pCur; 379 BnfLexer::Token *pCur;
diff --git a/src/tools/mkunit.cpp b/src/tools/mkunit.cpp
index 12ce65f..c0b7b8b 100644
--- a/src/tools/mkunit.cpp
+++ b/src/tools/mkunit.cpp
@@ -15,7 +15,7 @@ public:
15 { 15 {
16 } 16 }
17 17
18 Bu::FString sName; 18 Bu::String sName;
19 bool bExpectPass; 19 bool bExpectPass;
20}; 20};
21typedef Bu::List<Test> TestList; 21typedef Bu::List<Test> TestList;
@@ -23,7 +23,7 @@ typedef Bu::List<Test> TestList;
23class Suite 23class Suite
24{ 24{
25public: 25public:
26 Bu::FString sName; 26 Bu::String sName;
27 TestList lTest; 27 TestList lTest;
28}; 28};
29//typedef Bu::List<Suite> SuiteList; 29//typedef Bu::List<Suite> SuiteList;
@@ -66,7 +66,7 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const Suite &s )
66class Parser 66class Parser
67{ 67{
68public: 68public:
69 Parser( const Bu::FString &sFile ) : 69 Parser( const Bu::String &sFile ) :
70 sIn( sFile ), 70 sIn( sFile ),
71 fIn( sFile, File::Read ), 71 fIn( sFile, File::Read ),
72 bIn( fIn ), 72 bIn( fIn ),
@@ -99,10 +99,10 @@ public:
99 return cBuf; 99 return cBuf;
100 } 100 }
101 101
102 TokType nextToken( Variant &v, Bu::FString &sWsOut, int &iLineStart, 102 TokType nextToken( Variant &v, Bu::String &sWsOut, int &iLineStart,
103 int &iCharStart ) 103 int &iCharStart )
104 { 104 {
105 Bu::FString sTok, sWs; 105 Bu::String sTok, sWs;
106 106
107 char buf; 107 char buf;
108 try 108 try
@@ -307,7 +307,7 @@ public:
307 void firstPass() 307 void firstPass()
308 { 308 {
309 Variant v; 309 Variant v;
310 Bu::FString sWs; 310 Bu::String sWs;
311 int iL, iC; 311 int iL, iC;
312 for(;;) 312 for(;;)
313 { 313 {
@@ -322,7 +322,7 @@ public:
322 if( nextToken( v, sWs, iL, iC ) != tokFluff ) 322 if( nextToken( v, sWs, iL, iC ) != tokFluff )
323 throw Bu::ExceptionBase("%d:%d: Expected string " 323 throw Bu::ExceptionBase("%d:%d: Expected string "
324 "following suite.", iL, iC ); 324 "following suite.", iL, iC );
325 s.sName = v.get<Bu::FString>(); 325 s.sName = v.get<Bu::String>();
326 if( nextToken( v, sWs, iL, iC ) != tokChar || 326 if( nextToken( v, sWs, iL, iC ) != tokChar ||
327 v.get<char>() != '{' ) 327 v.get<char>() != '{' )
328 throw Bu::ExceptionBase("%d:%d: Expected {, got " 328 throw Bu::ExceptionBase("%d:%d: Expected {, got "
@@ -346,7 +346,7 @@ public:
346 throw Bu::ExceptionBase("%d:%d: Expected " 346 throw Bu::ExceptionBase("%d:%d: Expected "
347 "string following test.", iL, iC ); 347 "string following test.", iL, iC );
348 Test t; 348 Test t;
349 t.sName = v.get<Bu::FString>(); 349 t.sName = v.get<Bu::String>();
350 if( nextToken( v, sWs, iL, iC ) != tokBlock ) 350 if( nextToken( v, sWs, iL, iC ) != tokBlock )
351 throw Bu::ExceptionBase("%d:%d: Expected " 351 throw Bu::ExceptionBase("%d:%d: Expected "
352 "{...} block.", 352 "{...} block.",
@@ -380,7 +380,7 @@ public:
380 } 380 }
381 } 381 }
382 382
383 void secondPass( const Bu::FString &sOut ) 383 void secondPass( const Bu::String &sOut )
384 { 384 {
385 File fOut( sOut, File::WriteNew ); 385 File fOut( sOut, File::WriteNew );
386 Formatter f( fOut ); 386 Formatter f( fOut );
@@ -393,7 +393,7 @@ public:
393 iChar = 0; 393 iChar = 0;
394 bool bHasIncluded = false; 394 bool bHasIncluded = false;
395 395
396 Bu::FString sWs; 396 Bu::String sWs;
397 Variant v; 397 Variant v;
398 int iL, iC; 398 int iL, iC;
399 for(;;) 399 for(;;)
@@ -408,7 +408,7 @@ public:
408 if( nextToken( v, sWs, iL, iC ) != tokFluff ) 408 if( nextToken( v, sWs, iL, iC ) != tokFluff )
409 throw Bu::ExceptionBase("%d:%d: Expected string " 409 throw Bu::ExceptionBase("%d:%d: Expected string "
410 "following suite.", iL, iC ); 410 "following suite.", iL, iC );
411 s.sName = v.get<Bu::FString>(); 411 s.sName = v.get<Bu::String>();
412 if( nextToken( v, sWs, iL, iC ) != tokChar || 412 if( nextToken( v, sWs, iL, iC ) != tokChar ||
413 v.get<char>() != '{' ) 413 v.get<char>() != '{' )
414 throw Bu::ExceptionBase("%d:%d: Expected {", 414 throw Bu::ExceptionBase("%d:%d: Expected {",
@@ -421,7 +421,7 @@ public:
421 bHasIncluded = true; 421 bHasIncluded = true;
422 } 422 }
423 423
424 Bu::FString sClass = "_UnitSuite_" + s.sName; 424 Bu::String sClass = "_UnitSuite_" + s.sName;
425 f << "class " << sClass 425 f << "class " << sClass
426 << " : public Bu::UnitSuite" << f.nl 426 << " : public Bu::UnitSuite" << f.nl
427 << "{" << f.nl << "public:" << f.nl 427 << "{" << f.nl << "public:" << f.nl
@@ -441,7 +441,7 @@ public:
441 } 441 }
442 else if( t == tokEof ) 442 else if( t == tokEof )
443 { 443 {
444 Bu::FString sClass = "_UnitSuite_" + s.sName; 444 Bu::String sClass = "_UnitSuite_" + s.sName;
445 f << sWs << f.nl << "int main( int argc, char *argv[] )" 445 f << sWs << f.nl << "int main( int argc, char *argv[] )"
446 << f.nl << "{" << f.nl << "\treturn " << sClass 446 << f.nl << "{" << f.nl << "\treturn " << sClass
447 << "().run( argc, argv );" << f.nl << "}" << f.nl; 447 << "().run( argc, argv );" << f.nl << "}" << f.nl;
@@ -458,7 +458,7 @@ public:
458 { 458 {
459 case tokFluff: 459 case tokFluff:
460 fOut.write( sWs ); 460 fOut.write( sWs );
461 fOut.write( v.get<Bu::FString>() ); 461 fOut.write( v.get<Bu::String>() );
462 break; 462 break;
463 463
464 case tokTest: 464 case tokTest:
@@ -468,7 +468,7 @@ public:
468 throw Bu::ExceptionBase("%d:%d: Expected " 468 throw Bu::ExceptionBase("%d:%d: Expected "
469 "string following test.", iL, iC ); 469 "string following test.", iL, iC );
470 Test t; 470 Test t;
471 t.sName = v.get<Bu::FString>(); 471 t.sName = v.get<Bu::String>();
472 if( nextToken( v, sWs, iL, iC ) != tokBlock ) 472 if( nextToken( v, sWs, iL, iC ) != tokBlock )
473 throw Bu::ExceptionBase("%d:%d: Expected " 473 throw Bu::ExceptionBase("%d:%d: Expected "
474 "{...} block.", 474 "{...} block.",
@@ -499,7 +499,7 @@ public:
499 fOut.write( sWs ); 499 fOut.write( sWs );
500 f << f.nl << "#line " << iL << " \"" << sIn 500 f << f.nl << "#line " << iL << " \"" << sIn
501 << "\"" << f.nl; 501 << "\"" << f.nl;
502 fOut.write( v.get<Bu::FString>() ); 502 fOut.write( v.get<Bu::String>() );
503 503
504 break; 504 break;
505 505
@@ -521,7 +521,7 @@ public:
521 } 521 }
522 522
523private: 523private:
524 Bu::FString sIn; 524 Bu::String sIn;
525 File fIn; 525 File fIn;
526 Buffer bIn; 526 Buffer bIn;
527 char cBuf; 527 char cBuf;
diff --git a/src/tools/myriad.cpp b/src/tools/myriad.cpp
index b6e435d..7d7956e 100644
--- a/src/tools/myriad.cpp
+++ b/src/tools/myriad.cpp
@@ -75,9 +75,9 @@ public:
75 int iBlockSize; 75 int iBlockSize;
76 int iPreallocate; 76 int iPreallocate;
77 int iStream; 77 int iStream;
78 Bu::FString sFile; 78 Bu::String sFile;
79 Bu::FString sSrc; 79 Bu::String sSrc;
80 Bu::FString sDst; 80 Bu::String sDst;
81}; 81};
82 82
83Bu::Formatter &operator>>( Bu::Formatter &f, Mode &e ) 83Bu::Formatter &operator>>( Bu::Formatter &f, Mode &e )
diff --git a/src/tools/parser.cpp b/src/tools/parser.cpp
index 7933f31..8350343 100644
--- a/src/tools/parser.cpp
+++ b/src/tools/parser.cpp
@@ -118,7 +118,7 @@ public:
118 case '8': 118 case '8':
119 case '9': 119 case '9':
120 { 120 {
121 Bu::FString sTmp; 121 Bu::String sTmp;
122 sTmp += b; 122 sTmp += b;
123 qbIn.seek( 1 ); 123 qbIn.seek( 1 );
124 for(;;) 124 for(;;)
diff --git a/src/tools/viewcsv.cpp b/src/tools/viewcsv.cpp
index d81525e..9be1291 100644
--- a/src/tools/viewcsv.cpp
+++ b/src/tools/viewcsv.cpp
@@ -38,7 +38,7 @@ public:
38 return 0; 38 return 0;
39 } 39 }
40 40
41 Bu::FString sFileIn; 41 Bu::String sFileIn;
42 bool bHeader; 42 bool bHeader;
43}; 43};
44 44
@@ -245,10 +245,10 @@ public:
245 setHeaderRow( !bHeaderRow ); 245 setHeaderRow( !bHeaderRow );
246 } 246 }
247 247
248 Bu::FString prompt( const Bu::FString &sPrompt ) 248 Bu::String prompt( const Bu::String &sPrompt )
249 { 249 {
250 int maxx, maxy; 250 int maxx, maxy;
251 Bu::FString sStr; 251 Bu::String sStr;
252 252
253 RegEx re( sPrompt ); 253 RegEx re( sPrompt );
254 254
@@ -292,7 +292,7 @@ public:
292 sysCaret.reset(); 292 sysCaret.reset();
293 } 293 }
294 294
295 void findNext( const Bu::FString &sTerm ) 295 void findNext( const Bu::String &sTerm )
296 { 296 {
297 RegEx re( sTerm ); 297 RegEx re( sTerm );
298 298
@@ -398,7 +398,7 @@ int main( int argc, char *argv[] )
398 CsvView view( doc ); 398 CsvView view( doc );
399 view.setHeaderRow( opt.bHeader ); 399 view.setHeaderRow( opt.bHeader );
400 400
401 Bu::FString sSearchTerm; 401 Bu::String sSearchTerm;
402 402
403 bool bRun = true; 403 bool bRun = true;
404 do 404 do