aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/bnfcompile.cpp33
-rw-r--r--src/tools/mkunit.cpp41
-rw-r--r--src/tools/myriad.cpp8
-rw-r--r--src/tools/myriadfs.cpp7
-rw-r--r--src/tools/parser.cpp9
-rw-r--r--src/tools/viewcsv.cpp17
6 files changed, 75 insertions, 40 deletions
diff --git a/src/tools/bnfcompile.cpp b/src/tools/bnfcompile.cpp
index 16e75a5..011ec84 100644
--- a/src/tools/bnfcompile.cpp
+++ b/src/tools/bnfcompile.cpp
@@ -1,3 +1,10 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#include <bu/sio.h> 8#include <bu/sio.h>
2#include <bu/lexer.h> 9#include <bu/lexer.h>
3#include <bu/parser.h> 10#include <bu/parser.h>
@@ -123,7 +130,7 @@ public:
123 } 130 }
124 } 131 }
125 132
126 virtual FString tokenToString( const Token &t ) 133 virtual String tokenToString( const Token &t )
127 { 134 {
128 switch( (TokenType)t.iToken ) 135 switch( (TokenType)t.iToken )
129 { 136 {
@@ -146,7 +153,7 @@ public:
146private: 153private:
147 Stream &rSrc; 154 Stream &rSrc;
148 QueueBuf qbIn; 155 QueueBuf qbIn;
149 FString sBuf; 156 String sBuf;
150}; 157};
151 158
152class BnfParser 159class BnfParser
@@ -201,9 +208,9 @@ private:
201 next(); 208 next();
202 if( pCur->iToken == tokIdentifier ) 209 if( pCur->iToken == tokIdentifier )
203 { 210 {
204 hTokens.insert( pCur->vExtra.get<Bu::FString>(), ++iLastToken ); 211 hTokens.insert( pCur->vExtra.get<Bu::String>(), ++iLastToken );
205 sio << "Added token[" << iLastToken << "]: " 212 sio << "Added token[" << iLastToken << "]: "
206 << pCur->vExtra.get<Bu::FString>() << sio.nl; 213 << pCur->vExtra.get<Bu::String>() << sio.nl;
207 } 214 }
208 else if( pCur->iToken == tokSemiColon ) 215 else if( pCur->iToken == tokSemiColon )
209 break; 216 break;
@@ -214,7 +221,7 @@ private:
214 221
215 void nonTerminal() 222 void nonTerminal()
216 { 223 {
217 Bu::FString sNtName = pCur->vExtra.get<Bu::FString>(); 224 Bu::String sNtName = pCur->vExtra.get<Bu::String>();
218 Parser::NonTerminal nt; 225 Parser::NonTerminal nt;
219 p.addNonTerminal( sNtName ); 226 p.addNonTerminal( sNtName );
220 sio.incIndent(); 227 sio.incIndent();
@@ -258,8 +265,8 @@ private:
258 { 265 {
259 case tokIdentifier: 266 case tokIdentifier:
260 { 267 {
261 const Bu::FString &sName = 268 const Bu::String &sName =
262 pCur->vExtra.get<Bu::FString>(); 269 pCur->vExtra.get<Bu::String>();
263 if( hTokens.has( sName ) ) 270 if( hTokens.has( sName ) )
264 { 271 {
265 pr.append( 272 pr.append(
@@ -292,8 +299,8 @@ private:
292 next(); 299 next();
293 if( pCur->iToken != tokIdentifier ) 300 if( pCur->iToken != tokIdentifier )
294 tokenError("tokIdentifier"); 301 tokenError("tokIdentifier");
295 Bu::FString sName = 302 Bu::String sName =
296 pCur->vExtra.get<Bu::FString>(); 303 pCur->vExtra.get<Bu::String>();
297 next(); 304 next();
298 if( pCur->iToken != tokCloseSquare ) 305 if( pCur->iToken != tokCloseSquare )
299 tokenError("tokCloseSquare"); 306 tokenError("tokCloseSquare");
@@ -317,8 +324,8 @@ private:
317 next(); 324 next();
318 if( pCur->iToken != tokIdentifier ) 325 if( pCur->iToken != tokIdentifier )
319 tokenError("tokIdentifier"); 326 tokenError("tokIdentifier");
320 Bu::FString sName = 327 Bu::String sName =
321 pCur->vExtra.get<Bu::FString>(); 328 pCur->vExtra.get<Bu::String>();
322 next(); 329 next();
323 if( pCur->iToken != tokCloseCurly ) 330 if( pCur->iToken != tokCloseCurly )
324 tokenError("tokCloseCurly"); 331 tokenError("tokCloseCurly");
@@ -366,14 +373,14 @@ private:
366 pCur = l.nextToken(); 373 pCur = l.nextToken();
367 } 374 }
368 375
369 void tokenError( const FString &s ) 376 void tokenError( const String &s )
370 { 377 {
371 throw ExceptionBase( ("Expected " + s + " but found " 378 throw ExceptionBase( ("Expected " + s + " but found "
372 + l.tokenToString( *pCur ) + ".").getStr() ); 379 + l.tokenToString( *pCur ) + ".").getStr() );
373 } 380 }
374 381
375private: 382private:
376 typedef Bu::Hash<Bu::FString, int> TokenHash; 383 typedef Bu::Hash<Bu::String, int> TokenHash;
377 TokenHash hTokens; 384 TokenHash hTokens;
378 BnfLexer &l; 385 BnfLexer &l;
379 BnfLexer::Token *pCur; 386 BnfLexer::Token *pCur;
diff --git a/src/tools/mkunit.cpp b/src/tools/mkunit.cpp
index 12ce65f..741a888 100644
--- a/src/tools/mkunit.cpp
+++ b/src/tools/mkunit.cpp
@@ -1,3 +1,10 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#include <bu/file.h> 8#include <bu/file.h>
2#include <bu/optparser.h> 9#include <bu/optparser.h>
3#include <bu/buffer.h> 10#include <bu/buffer.h>
@@ -15,7 +22,7 @@ public:
15 { 22 {
16 } 23 }
17 24
18 Bu::FString sName; 25 Bu::String sName;
19 bool bExpectPass; 26 bool bExpectPass;
20}; 27};
21typedef Bu::List<Test> TestList; 28typedef Bu::List<Test> TestList;
@@ -23,7 +30,7 @@ typedef Bu::List<Test> TestList;
23class Suite 30class Suite
24{ 31{
25public: 32public:
26 Bu::FString sName; 33 Bu::String sName;
27 TestList lTest; 34 TestList lTest;
28}; 35};
29//typedef Bu::List<Suite> SuiteList; 36//typedef Bu::List<Suite> SuiteList;
@@ -66,7 +73,7 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const Suite &s )
66class Parser 73class Parser
67{ 74{
68public: 75public:
69 Parser( const Bu::FString &sFile ) : 76 Parser( const Bu::String &sFile ) :
70 sIn( sFile ), 77 sIn( sFile ),
71 fIn( sFile, File::Read ), 78 fIn( sFile, File::Read ),
72 bIn( fIn ), 79 bIn( fIn ),
@@ -99,10 +106,10 @@ public:
99 return cBuf; 106 return cBuf;
100 } 107 }
101 108
102 TokType nextToken( Variant &v, Bu::FString &sWsOut, int &iLineStart, 109 TokType nextToken( Variant &v, Bu::String &sWsOut, int &iLineStart,
103 int &iCharStart ) 110 int &iCharStart )
104 { 111 {
105 Bu::FString sTok, sWs; 112 Bu::String sTok, sWs;
106 113
107 char buf; 114 char buf;
108 try 115 try
@@ -307,7 +314,7 @@ public:
307 void firstPass() 314 void firstPass()
308 { 315 {
309 Variant v; 316 Variant v;
310 Bu::FString sWs; 317 Bu::String sWs;
311 int iL, iC; 318 int iL, iC;
312 for(;;) 319 for(;;)
313 { 320 {
@@ -322,7 +329,7 @@ public:
322 if( nextToken( v, sWs, iL, iC ) != tokFluff ) 329 if( nextToken( v, sWs, iL, iC ) != tokFluff )
323 throw Bu::ExceptionBase("%d:%d: Expected string " 330 throw Bu::ExceptionBase("%d:%d: Expected string "
324 "following suite.", iL, iC ); 331 "following suite.", iL, iC );
325 s.sName = v.get<Bu::FString>(); 332 s.sName = v.get<Bu::String>();
326 if( nextToken( v, sWs, iL, iC ) != tokChar || 333 if( nextToken( v, sWs, iL, iC ) != tokChar ||
327 v.get<char>() != '{' ) 334 v.get<char>() != '{' )
328 throw Bu::ExceptionBase("%d:%d: Expected {, got " 335 throw Bu::ExceptionBase("%d:%d: Expected {, got "
@@ -346,7 +353,7 @@ public:
346 throw Bu::ExceptionBase("%d:%d: Expected " 353 throw Bu::ExceptionBase("%d:%d: Expected "
347 "string following test.", iL, iC ); 354 "string following test.", iL, iC );
348 Test t; 355 Test t;
349 t.sName = v.get<Bu::FString>(); 356 t.sName = v.get<Bu::String>();
350 if( nextToken( v, sWs, iL, iC ) != tokBlock ) 357 if( nextToken( v, sWs, iL, iC ) != tokBlock )
351 throw Bu::ExceptionBase("%d:%d: Expected " 358 throw Bu::ExceptionBase("%d:%d: Expected "
352 "{...} block.", 359 "{...} block.",
@@ -380,7 +387,7 @@ public:
380 } 387 }
381 } 388 }
382 389
383 void secondPass( const Bu::FString &sOut ) 390 void secondPass( const Bu::String &sOut )
384 { 391 {
385 File fOut( sOut, File::WriteNew ); 392 File fOut( sOut, File::WriteNew );
386 Formatter f( fOut ); 393 Formatter f( fOut );
@@ -393,7 +400,7 @@ public:
393 iChar = 0; 400 iChar = 0;
394 bool bHasIncluded = false; 401 bool bHasIncluded = false;
395 402
396 Bu::FString sWs; 403 Bu::String sWs;
397 Variant v; 404 Variant v;
398 int iL, iC; 405 int iL, iC;
399 for(;;) 406 for(;;)
@@ -408,7 +415,7 @@ public:
408 if( nextToken( v, sWs, iL, iC ) != tokFluff ) 415 if( nextToken( v, sWs, iL, iC ) != tokFluff )
409 throw Bu::ExceptionBase("%d:%d: Expected string " 416 throw Bu::ExceptionBase("%d:%d: Expected string "
410 "following suite.", iL, iC ); 417 "following suite.", iL, iC );
411 s.sName = v.get<Bu::FString>(); 418 s.sName = v.get<Bu::String>();
412 if( nextToken( v, sWs, iL, iC ) != tokChar || 419 if( nextToken( v, sWs, iL, iC ) != tokChar ||
413 v.get<char>() != '{' ) 420 v.get<char>() != '{' )
414 throw Bu::ExceptionBase("%d:%d: Expected {", 421 throw Bu::ExceptionBase("%d:%d: Expected {",
@@ -421,7 +428,7 @@ public:
421 bHasIncluded = true; 428 bHasIncluded = true;
422 } 429 }
423 430
424 Bu::FString sClass = "_UnitSuite_" + s.sName; 431 Bu::String sClass = "_UnitSuite_" + s.sName;
425 f << "class " << sClass 432 f << "class " << sClass
426 << " : public Bu::UnitSuite" << f.nl 433 << " : public Bu::UnitSuite" << f.nl
427 << "{" << f.nl << "public:" << f.nl 434 << "{" << f.nl << "public:" << f.nl
@@ -441,7 +448,7 @@ public:
441 } 448 }
442 else if( t == tokEof ) 449 else if( t == tokEof )
443 { 450 {
444 Bu::FString sClass = "_UnitSuite_" + s.sName; 451 Bu::String sClass = "_UnitSuite_" + s.sName;
445 f << sWs << f.nl << "int main( int argc, char *argv[] )" 452 f << sWs << f.nl << "int main( int argc, char *argv[] )"
446 << f.nl << "{" << f.nl << "\treturn " << sClass 453 << f.nl << "{" << f.nl << "\treturn " << sClass
447 << "().run( argc, argv );" << f.nl << "}" << f.nl; 454 << "().run( argc, argv );" << f.nl << "}" << f.nl;
@@ -458,7 +465,7 @@ public:
458 { 465 {
459 case tokFluff: 466 case tokFluff:
460 fOut.write( sWs ); 467 fOut.write( sWs );
461 fOut.write( v.get<Bu::FString>() ); 468 fOut.write( v.get<Bu::String>() );
462 break; 469 break;
463 470
464 case tokTest: 471 case tokTest:
@@ -468,7 +475,7 @@ public:
468 throw Bu::ExceptionBase("%d:%d: Expected " 475 throw Bu::ExceptionBase("%d:%d: Expected "
469 "string following test.", iL, iC ); 476 "string following test.", iL, iC );
470 Test t; 477 Test t;
471 t.sName = v.get<Bu::FString>(); 478 t.sName = v.get<Bu::String>();
472 if( nextToken( v, sWs, iL, iC ) != tokBlock ) 479 if( nextToken( v, sWs, iL, iC ) != tokBlock )
473 throw Bu::ExceptionBase("%d:%d: Expected " 480 throw Bu::ExceptionBase("%d:%d: Expected "
474 "{...} block.", 481 "{...} block.",
@@ -499,7 +506,7 @@ public:
499 fOut.write( sWs ); 506 fOut.write( sWs );
500 f << f.nl << "#line " << iL << " \"" << sIn 507 f << f.nl << "#line " << iL << " \"" << sIn
501 << "\"" << f.nl; 508 << "\"" << f.nl;
502 fOut.write( v.get<Bu::FString>() ); 509 fOut.write( v.get<Bu::String>() );
503 510
504 break; 511 break;
505 512
@@ -521,7 +528,7 @@ public:
521 } 528 }
522 529
523private: 530private:
524 Bu::FString sIn; 531 Bu::String sIn;
525 File fIn; 532 File fIn;
526 Buffer bIn; 533 Buffer bIn;
527 char cBuf; 534 char cBuf;
diff --git a/src/tools/myriad.cpp b/src/tools/myriad.cpp
index b6e435d..7d4df75 100644
--- a/src/tools/myriad.cpp
+++ b/src/tools/myriad.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2010 Xagasoft, All rights reserved. 2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 * 3 *
4 * This file is part of the libbu++ library and is released under the 4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
@@ -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/myriadfs.cpp b/src/tools/myriadfs.cpp
index 66955a5..88db0c0 100644
--- a/src/tools/myriadfs.cpp
+++ b/src/tools/myriadfs.cpp
@@ -1,3 +1,10 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#define FUSE_USE_VERSION 26 8#define FUSE_USE_VERSION 26
2 9
3#include <fuse.h> 10#include <fuse.h>
diff --git a/src/tools/parser.cpp b/src/tools/parser.cpp
index 7933f31..aa9e3e4 100644
--- a/src/tools/parser.cpp
+++ b/src/tools/parser.cpp
@@ -1,3 +1,10 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#include <bu/parser.h> 8#include <bu/parser.h>
2#include <bu/lexer.h> 9#include <bu/lexer.h>
3#include <bu/file.h> 10#include <bu/file.h>
@@ -118,7 +125,7 @@ public:
118 case '8': 125 case '8':
119 case '9': 126 case '9':
120 { 127 {
121 Bu::FString sTmp; 128 Bu::String sTmp;
122 sTmp += b; 129 sTmp += b;
123 qbIn.seek( 1 ); 130 qbIn.seek( 1 );
124 for(;;) 131 for(;;)
diff --git a/src/tools/viewcsv.cpp b/src/tools/viewcsv.cpp
index d81525e..6997b9b 100644
--- a/src/tools/viewcsv.cpp
+++ b/src/tools/viewcsv.cpp
@@ -1,3 +1,10 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#include <bu/sio.h> 8#include <bu/sio.h>
2#include <bu/optparser.h> 9#include <bu/optparser.h>
3#include <bu/csvreader.h> 10#include <bu/csvreader.h>
@@ -38,7 +45,7 @@ public:
38 return 0; 45 return 0;
39 } 46 }
40 47
41 Bu::FString sFileIn; 48 Bu::String sFileIn;
42 bool bHeader; 49 bool bHeader;
43}; 50};
44 51
@@ -245,10 +252,10 @@ public:
245 setHeaderRow( !bHeaderRow ); 252 setHeaderRow( !bHeaderRow );
246 } 253 }
247 254
248 Bu::FString prompt( const Bu::FString &sPrompt ) 255 Bu::String prompt( const Bu::String &sPrompt )
249 { 256 {
250 int maxx, maxy; 257 int maxx, maxy;
251 Bu::FString sStr; 258 Bu::String sStr;
252 259
253 RegEx re( sPrompt ); 260 RegEx re( sPrompt );
254 261
@@ -292,7 +299,7 @@ public:
292 sysCaret.reset(); 299 sysCaret.reset();
293 } 300 }
294 301
295 void findNext( const Bu::FString &sTerm ) 302 void findNext( const Bu::String &sTerm )
296 { 303 {
297 RegEx re( sTerm ); 304 RegEx re( sTerm );
298 305
@@ -398,7 +405,7 @@ int main( int argc, char *argv[] )
398 CsvView view( doc ); 405 CsvView view( doc );
399 view.setHeaderRow( opt.bHeader ); 406 view.setHeaderRow( opt.bHeader );
400 407
401 Bu::FString sSearchTerm; 408 Bu::String sSearchTerm;
402 409
403 bool bRun = true; 410 bool bRun = true;
404 do 411 do