diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/conduit.cpp | 8 | ||||
| -rw-r--r-- | src/formatter.h | 6 | ||||
| -rw-r--r-- | src/itoserver.cpp | 2 | ||||
| -rw-r--r-- | src/myriad.cpp | 4 | ||||
| -rw-r--r-- | src/myriadfs.cpp | 8 | ||||
| -rw-r--r-- | src/optparser.cpp | 2 | ||||
| -rw-r--r-- | src/programchain.cpp | 104 | ||||
| -rw-r--r-- | src/programchain.h | 99 | ||||
| -rw-r--r-- | src/programlink.cpp | 63 | ||||
| -rw-r--r-- | src/programlink.h | 106 | ||||
| -rw-r--r-- | src/tests/myriadfs.cpp | 2 | ||||
| -rw-r--r-- | src/tests/utf.cpp | 2 | ||||
| -rw-r--r-- | src/tools/bnfcompile.cpp | 5 | ||||
| -rw-r--r-- | src/tools/myriad.cpp | 2 | ||||
| -rw-r--r-- | src/tools/parser.cpp | 5 | ||||
| -rw-r--r-- | src/utfstring.cpp | 8 |
16 files changed, 31 insertions, 395 deletions
diff --git a/src/conduit.cpp b/src/conduit.cpp index cfa93d8..c9ccdc4 100644 --- a/src/conduit.cpp +++ b/src/conduit.cpp | |||
| @@ -116,15 +116,15 @@ Bu::size Bu::Conduit::tell() | |||
| 116 | return sRet; | 116 | return sRet; |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | void Bu::Conduit::seek( Bu::size offset ) | 119 | void Bu::Conduit::seek( Bu::size ) |
| 120 | { | 120 | { |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | void Bu::Conduit::setPos( Bu::size pos ) | 123 | void Bu::Conduit::setPos( Bu::size ) |
| 124 | { | 124 | { |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | void Bu::Conduit::setPosEnd( Bu::size pos ) | 127 | void Bu::Conduit::setPosEnd( Bu::size ) |
| 128 | { | 128 | { |
| 129 | } | 129 | } |
| 130 | 130 | ||
| @@ -203,7 +203,7 @@ void Bu::Conduit::setBlocking( bool bBlocking ) | |||
| 203 | im.unlock(); | 203 | im.unlock(); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | void Bu::Conduit::setSize( Bu::size iSize ) | 206 | void Bu::Conduit::setSize( Bu::size ) |
| 207 | { | 207 | { |
| 208 | } | 208 | } |
| 209 | 209 | ||
diff --git a/src/formatter.h b/src/formatter.h index 5840323..80a55ab 100644 --- a/src/formatter.h +++ b/src/formatter.h | |||
| @@ -135,7 +135,6 @@ namespace Bu | |||
| 135 | void ffmt( type f ) | 135 | void ffmt( type f ) |
| 136 | { | 136 | { |
| 137 | Bu::String fTmp; | 137 | Bu::String fTmp; |
| 138 | bool bNeg = false; | ||
| 139 | char cBase = fLast.bCaps?'A':'a'; | 138 | char cBase = fLast.bCaps?'A':'a'; |
| 140 | if( fLast.uRadix < 2 || fLast.uRadix > 36 ) | 139 | if( fLast.uRadix < 2 || fLast.uRadix > 36 ) |
| 141 | { | 140 | { |
| @@ -145,7 +144,6 @@ namespace Bu | |||
| 145 | 144 | ||
| 146 | if( signbit(f) ) | 145 | if( signbit(f) ) |
| 147 | { | 146 | { |
| 148 | bNeg = true; | ||
| 149 | f = -f; | 147 | f = -f; |
| 150 | fTmp += "-"; | 148 | fTmp += "-"; |
| 151 | } | 149 | } |
| @@ -228,7 +226,9 @@ namespace Bu | |||
| 228 | template<typename type> | 226 | template<typename type> |
| 229 | void fparse( type &f, const Bu::String &sBuf ) | 227 | void fparse( type &f, const Bu::String &sBuf ) |
| 230 | { | 228 | { |
| 231 | sscanf( sBuf.getStr(), "%f", &f ); | 229 | double fIn; |
| 230 | sscanf( sBuf.getStr(), "%lf", &fIn ); | ||
| 231 | f = fIn; | ||
| 232 | usedFormat(); | 232 | usedFormat(); |
| 233 | } | 233 | } |
| 234 | 234 | ||
diff --git a/src/itoserver.cpp b/src/itoserver.cpp index 9f03417..c7165e2 100644 --- a/src/itoserver.cpp +++ b/src/itoserver.cpp | |||
| @@ -80,7 +80,7 @@ void Bu::ItoServer::run() | |||
| 80 | struct timeval xTimeout = { nTimeoutSec, nTimeoutUSec }; | 80 | struct timeval xTimeout = { nTimeoutSec, nTimeoutUSec }; |
| 81 | 81 | ||
| 82 | fd_set fdRead = fdActive; | 82 | fd_set fdRead = fdActive; |
| 83 | fd_set fdWrite = fdActive; | 83 | //fd_set fdWrite = fdActive; |
| 84 | fd_set fdException = fdActive; | 84 | fd_set fdException = fdActive; |
| 85 | 85 | ||
| 86 | if( TEMP_FAILURE_RETRY( select( FD_SETSIZE, &fdRead, NULL, &fdException, &xTimeout ) ) < 0 ) | 86 | if( TEMP_FAILURE_RETRY( select( FD_SETSIZE, &fdRead, NULL, &fdException, &xTimeout ) ) < 0 ) |
diff --git a/src/myriad.cpp b/src/myriad.cpp index b582df3..de44930 100644 --- a/src/myriad.cpp +++ b/src/myriad.cpp | |||
| @@ -128,7 +128,7 @@ void Bu::Myriad::initialize() | |||
| 128 | 128 | ||
| 129 | bsBlockUsed.setSize( iBlocks, true ); | 129 | bsBlockUsed.setSize( iBlocks, true ); |
| 130 | 130 | ||
| 131 | bool bCanSkip = false; // Can skip around, post initial header stream i/o | 131 | // bool bCanSkip = false; // Can skip around, post initial header stream i/o |
| 132 | MyriadStream *pIn = new MyriadStream( *this, pFakeHdr ); | 132 | MyriadStream *pIn = new MyriadStream( *this, pFakeHdr ); |
| 133 | pIn->setPos( sStore.tell() ); | 133 | pIn->setPos( sStore.tell() ); |
| 134 | for( int j = 0; j < iStreams; j++ ) | 134 | for( int j = 0; j < iStreams; j++ ) |
| @@ -156,7 +156,7 @@ void Bu::Myriad::initialize() | |||
| 156 | { | 156 | { |
| 157 | // sio << "Myriad: - End of prepartition, unlocking skipping." | 157 | // sio << "Myriad: - End of prepartition, unlocking skipping." |
| 158 | // << sio.nl; | 158 | // << sio.nl; |
| 159 | bCanSkip = true; | 159 | // bCanSkip = true; |
| 160 | MyriadStream *pTmp = new MyriadStream( *this, aStreams[0] ); | 160 | MyriadStream *pTmp = new MyriadStream( *this, aStreams[0] ); |
| 161 | // sio << "Myriad - Position = " << pIn->tell() << sio.nl; | 161 | // sio << "Myriad - Position = " << pIn->tell() << sio.nl; |
| 162 | pTmp->setPos( pIn->tell() ); | 162 | pTmp->setPos( pIn->tell() ); |
diff --git a/src/myriadfs.cpp b/src/myriadfs.cpp index cebae1c..6884a31 100644 --- a/src/myriadfs.cpp +++ b/src/myriadfs.cpp | |||
| @@ -112,7 +112,7 @@ void Bu::MyriadFs::stat( const Bu::String &sPath, Bu::MyriadFs::Stat &rBuf ) | |||
| 112 | stat( iNode, rBuf, is ); | 112 | stat( iNode, rBuf, is ); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | Bu::MyriadStream Bu::MyriadFs::open( const Bu::String &sPath, int iMode, | 115 | Bu::MyriadStream Bu::MyriadFs::open( const Bu::String &sPath, int /*iMode*/, |
| 116 | uint16_t uPerms ) | 116 | uint16_t uPerms ) |
| 117 | { | 117 | { |
| 118 | int32_t iParent = -1; | 118 | int32_t iParent = -1; |
| @@ -291,9 +291,9 @@ void Bu::MyriadFs::setTimes( const Bu::String &sPath, int64_t iATime, | |||
| 291 | void Bu::MyriadFs::unlink( const Bu::String &sPath ) | 291 | void Bu::MyriadFs::unlink( const Bu::String &sPath ) |
| 292 | { | 292 | { |
| 293 | int32_t iParent = -1; | 293 | int32_t iParent = -1; |
| 294 | int32_t iNode; | 294 | // int32_t iNode; |
| 295 | 295 | ||
| 296 | iNode = lookupInode( sPath, iParent ); | 296 | /*iNode =*/ lookupInode( sPath, iParent ); |
| 297 | 297 | ||
| 298 | Dir lDir = readDir( iParent ); | 298 | Dir lDir = readDir( iParent ); |
| 299 | 299 | ||
| @@ -660,7 +660,7 @@ void Bu::MyriadFs::destroyNode( int32_t iNode ) | |||
| 660 | Bu::MyriadStream is = mStore.openStream( 2 ); | 660 | Bu::MyriadStream is = mStore.openStream( 2 ); |
| 661 | 661 | ||
| 662 | // This will be overwritten with the last node | 662 | // This will be overwritten with the last node |
| 663 | int32_t iPosition = hNodeIndex.get( iNode ); | 663 | uint32_t iPosition = hNodeIndex.get( iNode ); |
| 664 | RawStat rsOld; | 664 | RawStat rsOld; |
| 665 | readInode( iNode, rsOld, is ); | 665 | readInode( iNode, rsOld, is ); |
| 666 | switch( (rsOld.uPerms&typeMask) ) | 666 | switch( (rsOld.uPerms&typeMask) ) |
diff --git a/src/optparser.cpp b/src/optparser.cpp index 74aba3e..050232c 100644 --- a/src/optparser.cpp +++ b/src/optparser.cpp | |||
| @@ -375,11 +375,9 @@ Bu::String Bu::OptParser::format( const Bu::String &sIn, int iWidth, | |||
| 375 | bool bSpace = false; | 375 | bool bSpace = false; |
| 376 | int iPrevLineLen; | 376 | int iPrevLineLen; |
| 377 | int iLineLen = 0; | 377 | int iLineLen = 0; |
| 378 | char c; | ||
| 379 | Bu::String::const_iterator iLastSpace, iStart; | 378 | Bu::String::const_iterator iLastSpace, iStart; |
| 380 | for( Bu::String::const_iterator i = iLastSpace = iStart = sIn.begin(); i; i++ ) | 379 | for( Bu::String::const_iterator i = iLastSpace = iStart = sIn.begin(); i; i++ ) |
| 381 | { | 380 | { |
| 382 | c = *i; | ||
| 383 | if( *i == ' ' ) | 381 | if( *i == ' ' ) |
| 384 | { | 382 | { |
| 385 | if( bSpace == false ) | 383 | if( bSpace == false ) |
diff --git a/src/programchain.cpp b/src/programchain.cpp deleted file mode 100644 index ce0c9cc..0000000 --- a/src/programchain.cpp +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 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 | |||
| 8 | #include <stdlib.h> | ||
| 9 | #include "bu/programchain.h" | ||
| 10 | #include "bu/programlink.h" | ||
| 11 | |||
| 12 | using namespace Bu; | ||
| 13 | |||
| 14 | Bu::ProgramChain::ProgramChain() | ||
| 15 | { | ||
| 16 | } | ||
| 17 | |||
| 18 | Bu::ProgramChain::~ProgramChain() | ||
| 19 | { | ||
| 20 | } | ||
| 21 | |||
| 22 | bool Bu::ProgramChain::addLink( ProgramLink *pLink ) | ||
| 23 | { | ||
| 24 | if( pLink->init() == false ) | ||
| 25 | { | ||
| 26 | emergencyShutdown(); | ||
| 27 | return false; | ||
| 28 | } | ||
| 29 | |||
| 30 | lLink.append( pLink ); | ||
| 31 | |||
| 32 | pLink->setChain( this ); | ||
| 33 | |||
| 34 | return true; | ||
| 35 | } | ||
| 36 | |||
| 37 | ProgramLink *Bu::ProgramChain::getLink( const char *lpName ) | ||
| 38 | { | ||
| 39 | char a; | ||
| 40 | a = lpName[0]; | ||
| 41 | return NULL; | ||
| 42 | } | ||
| 43 | |||
| 44 | ProgramLink *Bu::ProgramChain::getBaseLink() | ||
| 45 | { | ||
| 46 | return NULL; | ||
| 47 | } | ||
| 48 | |||
| 49 | bool Bu::ProgramChain::execChainOnce() | ||
| 50 | { | ||
| 51 | for( Bu::List<Bu::ProgramLink *>::iterator i = lLink.begin(); | ||
| 52 | i != lLink.end(); i++ ) | ||
| 53 | { | ||
| 54 | if( (*i)->timeSlice() == false ) | ||
| 55 | { | ||
| 56 | emergencyShutdown(); | ||
| 57 | return false; | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | return true; | ||
| 62 | } | ||
| 63 | |||
| 64 | bool Bu::ProgramChain::enterChainLoop() | ||
| 65 | { | ||
| 66 | for(;;) | ||
| 67 | { | ||
| 68 | if( execChainOnce() == false ) | ||
| 69 | { | ||
| 70 | return false; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | return true; | ||
| 75 | } | ||
| 76 | |||
| 77 | void Bu::ProgramChain::emergencyShutdown() | ||
| 78 | { | ||
| 79 | for( Bu::List<Bu::ProgramLink *>::iterator i = lLink.begin(); | ||
| 80 | i != lLink.end(); i++ ) | ||
| 81 | { | ||
| 82 | (*i)->deInit(); | ||
| 83 | delete *i; | ||
| 84 | } | ||
| 85 | lLink.clear(); | ||
| 86 | } | ||
| 87 | |||
| 88 | LinkMessage *Bu::ProgramChain::broadcastIRM( LinkMessage *pMsgOut, ProgramLink * /*pSender*/ ) | ||
| 89 | { | ||
| 90 | for( Bu::List<Bu::ProgramLink *>::iterator i = lLink.begin(); | ||
| 91 | i != lLink.end(); i++ ) | ||
| 92 | { | ||
| 93 | LinkMessage *pMsg = (*i)->processIRM( pMsgOut ); | ||
| 94 | if( pMsg != NULL ) | ||
| 95 | { | ||
| 96 | delete pMsgOut; | ||
| 97 | return pMsg; | ||
| 98 | } | ||
| 99 | } | ||
| 100 | |||
| 101 | delete pMsgOut; | ||
| 102 | return NULL; | ||
| 103 | } | ||
| 104 | |||
diff --git a/src/programchain.h b/src/programchain.h deleted file mode 100644 index 47797a2..0000000 --- a/src/programchain.h +++ /dev/null | |||
| @@ -1,99 +0,0 @@ | |||
| 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 | |||
| 8 | #ifndef BU_PROGRAMCHAIN_H | ||
| 9 | #define BU_PROGRAMCHAIN_H | ||
| 10 | |||
| 11 | #include "bu/list.h" | ||
| 12 | #include "bu/linkmessage.h" | ||
| 13 | |||
| 14 | namespace Bu | ||
| 15 | { | ||
| 16 | class ProgramLink; | ||
| 17 | /** | ||
| 18 | * The Program Chain links together program "chunks" to more easily facilitate | ||
| 19 | * a generalized program loop with modular extensions. | ||
| 20 | */ | ||
| 21 | class ProgramChain | ||
| 22 | { | ||
| 23 | public: | ||
| 24 | /** | ||
| 25 | * Construct an empty chain. | ||
| 26 | */ | ||
| 27 | ProgramChain(); | ||
| 28 | |||
| 29 | /** | ||
| 30 | * Destroy your chain. | ||
| 31 | */ | ||
| 32 | virtual ~ProgramChain(); | ||
| 33 | |||
| 34 | /** | ||
| 35 | * Adds a link to the end of the chain. | ||
| 36 | *@param pLink A pointer to the link to add to the chain. | ||
| 37 | *@returns True if adding the link was successful, otherwise false | ||
| 38 | */ | ||
| 39 | bool addLink( Bu::ProgramLink *pLink ); | ||
| 40 | |||
| 41 | /** | ||
| 42 | * Gets a link by name. | ||
| 43 | *@param lpName The name of the link you're looking for. Every link has a | ||
| 44 | * name, apparently. | ||
| 45 | *@returns A pointer to the specified ProgramLink, or NULL if none were | ||
| 46 | * found matching your criteria. | ||
| 47 | */ | ||
| 48 | class ProgramLink *getLink( const char *lpName ); | ||
| 49 | |||
| 50 | /** | ||
| 51 | * Gets the very first link in the chain. | ||
| 52 | *@returns A pointer to the first link in the chain. | ||
| 53 | */ | ||
| 54 | class ProgramLink *getBaseLink(); | ||
| 55 | |||
| 56 | /** | ||
| 57 | * Runs through the chain once. Useful if you want to have more control | ||
| 58 | * over the operation of the chain. | ||
| 59 | *@returns true if every link returned true. If at least one link returns | ||
| 60 | * false, then returns false. | ||
| 61 | */ | ||
| 62 | bool execChainOnce(); | ||
| 63 | |||
| 64 | /** | ||
| 65 | * Enters the master chain loop, looping over the entire chain and | ||
| 66 | * executing every link's TimeSlice routine in order, over and over, until | ||
| 67 | * a link returns a false value. | ||
| 68 | *@returns False, always. It returns true unless a link returned false, | ||
| 69 | * but loops until a link does return false. | ||
| 70 | **/ | ||
| 71 | bool enterChainLoop(); | ||
| 72 | |||
| 73 | /** | ||
| 74 | * Broadcasts an Immediate Response Message to all active links, save the | ||
| 75 | * sender. Whatever link first responds with a non-null response message | ||
| 76 | * will have it's messages sent back to the broadcasting link as the returns | ||
| 77 | * of this function call. Therefore it is very important that all message | ||
| 78 | * processing code is handled in a fairly timely fasion. | ||
| 79 | *@param pMsgOut The message to broadcast in hopes of a response. | ||
| 80 | *@param pSender The message that sent out the message and doesn't want to | ||
| 81 | * receive it's own message. This should always just be "this". | ||
| 82 | *@returns The message that was returned by the first link to return a | ||
| 83 | * non-null response. If all messages return null responses then this also | ||
| 84 | * returns null. Please note that whoever calls this will be responsible | ||
| 85 | * for deleting the message returned by it, if non-null. | ||
| 86 | */ | ||
| 87 | class LinkMessage *broadcastIRM( LinkMessage *pMsgOut, ProgramLink *pSender ); | ||
| 88 | |||
| 89 | private: | ||
| 90 | /** | ||
| 91 | * Shuts down all operation no matter what point in the operation we were. | ||
| 92 | */ | ||
| 93 | void emergencyShutdown(); | ||
| 94 | Bu::List<Bu::ProgramLink *> lLink; /**< The linked list that contains all of the links. */ | ||
| 95 | }; | ||
| 96 | } | ||
| 97 | |||
| 98 | |||
| 99 | #endif | ||
diff --git a/src/programlink.cpp b/src/programlink.cpp deleted file mode 100644 index f9453c2..0000000 --- a/src/programlink.cpp +++ /dev/null | |||
| @@ -1,63 +0,0 @@ | |||
| 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 | |||
| 8 | #include "bu/programlink.h" | ||
| 9 | #include "bu/programchain.h" | ||
| 10 | |||
| 11 | using namespace Bu; | ||
| 12 | |||
| 13 | Bu::ProgramLink::ProgramLink() | ||
| 14 | { | ||
| 15 | } | ||
| 16 | |||
| 17 | Bu::ProgramLink::~ProgramLink() | ||
| 18 | { | ||
| 19 | } | ||
| 20 | |||
| 21 | LinkMessage *Bu::ProgramLink::sendIRM( LinkMessage *pMsgOut ) | ||
| 22 | { | ||
| 23 | return pChain->broadcastIRM( pMsgOut, this ); | ||
| 24 | } | ||
| 25 | |||
| 26 | void Bu::ProgramLink::setChain( ProgramChain *pNewChain ) | ||
| 27 | { | ||
| 28 | pChain = pNewChain; | ||
| 29 | } | ||
| 30 | |||
| 31 | /* | ||
| 32 | void ProgramLink::postMessage( LinkMessage *pMsg, int nLvl ) | ||
| 33 | { | ||
| 34 | if( nLvl == msgToChain ) | ||
| 35 | { | ||
| 36 | qMsgToChain.enqueue( pMsg ); | ||
| 37 | } | ||
| 38 | else if( nLvl == msgToLink ) | ||
| 39 | { | ||
| 40 | qMsgToLink.enqueue( pMsg ); | ||
| 41 | } | ||
| 42 | else | ||
| 43 | { | ||
| 44 | // ERROR! | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | LinkMessage *ProgramLink::getMessage( int nLvl ) | ||
| 49 | { | ||
| 50 | if( nLvl == msgToChain ) | ||
| 51 | { | ||
| 52 | return (LinkMessage *)qMsgToChain.dequeue(); | ||
| 53 | } | ||
| 54 | else if( nLvl == msgToLink ) | ||
| 55 | { | ||
| 56 | return (LinkMessage *)qMsgToLink.dequeue(); | ||
| 57 | } | ||
| 58 | else | ||
| 59 | { | ||
| 60 | // ERROR! | ||
| 61 | } | ||
| 62 | } | ||
| 63 | */ | ||
diff --git a/src/programlink.h b/src/programlink.h deleted file mode 100644 index 36a605e..0000000 --- a/src/programlink.h +++ /dev/null | |||
| @@ -1,106 +0,0 @@ | |||
| 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 | |||
| 8 | #ifndef BU_PROGRAMLINK_H | ||
| 9 | #define BU_PROGRAMLINK_H | ||
| 10 | |||
| 11 | #include "bu/linkmessage.h" | ||
| 12 | #include "bu/programchain.h" | ||
| 13 | |||
| 14 | namespace Bu | ||
| 15 | { | ||
| 16 | /** | ||
| 17 | * Program Link is the base class for any object that will be a piece of the | ||
| 18 | * main program chain loop. | ||
| 19 | */ | ||
| 20 | class ProgramLink | ||
| 21 | { | ||
| 22 | friend class Bu::ProgramChain; | ||
| 23 | public: | ||
| 24 | /** | ||
| 25 | * Construct a program link. | ||
| 26 | */ | ||
| 27 | ProgramLink(); | ||
| 28 | |||
| 29 | /** | ||
| 30 | * Deconstruct. | ||
| 31 | */ | ||
| 32 | virtual ~ProgramLink(); | ||
| 33 | |||
| 34 | /** | ||
| 35 | * Initialization code required for a link that wasn't performed in the | ||
| 36 | * constructor. | ||
| 37 | *@returns true if initialization was successful. A false value will halt | ||
| 38 | * the chain. | ||
| 39 | */ | ||
| 40 | virtual bool init()=0; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * DeInitialization code that should happen, but doesn't belong in the | ||
| 44 | * destructor. | ||
| 45 | *@returns true means everything worked, false means failure, but is | ||
| 46 | * meaningless. | ||
| 47 | */ | ||
| 48 | virtual bool deInit()=0; | ||
| 49 | |||
| 50 | /** | ||
| 51 | * Executed once per link per chain pass. Contains the guts of the program. | ||
| 52 | *@returns true if everything went well. A false value will halt the chain. | ||
| 53 | */ | ||
| 54 | virtual bool timeSlice()=0; | ||
| 55 | |||
| 56 | /** | ||
| 57 | * This must be handled in order to process Instant Response Messages. | ||
| 58 | * This function should return null on all messages that it doesn't | ||
| 59 | * understand how to handle, and construct new messages to return to sender | ||
| 60 | * in the cases where it does understand. | ||
| 61 | *@param pMsgIn The message that must be processed. | ||
| 62 | *@returns Either a new message in cases where a response is required, | ||
| 63 | * or null if nothing needs to be done by this link. | ||
| 64 | */ | ||
| 65 | virtual LinkMessage *processIRM( LinkMessage *pMsgIn ) = 0; | ||
| 66 | |||
| 67 | /** | ||
| 68 | * Broadcast a LinkMessage to all other links in the system. Each other | ||
| 69 | * link will get a call of their processIRM function. If the message gets | ||
| 70 | * a response then you will regain control immediately, otherwise the system | ||
| 71 | * will give all other Links a chance to respond before returning NULL. | ||
| 72 | *@param pMsgOut The message to broadcast. | ||
| 73 | *@returns The message response, or NULL if no Link understood your message. | ||
| 74 | */ | ||
| 75 | LinkMessage *sendIRM( LinkMessage *pMsgOut ); | ||
| 76 | |||
| 77 | private: | ||
| 78 | /** | ||
| 79 | * Set which chain we're assosiated with. This is how IRM messages make | ||
| 80 | * it out to the rest of the world. | ||
| 81 | *@param pNewChain A pointer to the containing program chain. | ||
| 82 | */ | ||
| 83 | void setChain( class ProgramChain *pNewChain ); | ||
| 84 | |||
| 85 | /** | ||
| 86 | * The pointer to the containing chain. | ||
| 87 | */ | ||
| 88 | class ProgramChain *pChain; | ||
| 89 | /* | ||
| 90 | void postMessage( LinkMessage *pMsg, int nLvl ); | ||
| 91 | LinkMessage *getMessage( int nLvl ); | ||
| 92 | |||
| 93 | enum | ||
| 94 | { | ||
| 95 | msgToChain, | ||
| 96 | msgToLink | ||
| 97 | }; | ||
| 98 | |||
| 99 | private: | ||
| 100 | Queue qMsgToChain; | ||
| 101 | Queue qMsgToLink; | ||
| 102 | */ | ||
| 103 | }; | ||
| 104 | } | ||
| 105 | |||
| 106 | #endif | ||
diff --git a/src/tests/myriadfs.cpp b/src/tests/myriadfs.cpp index 5946b27..f57f02d 100644 --- a/src/tests/myriadfs.cpp +++ b/src/tests/myriadfs.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | using namespace Bu; | 7 | using namespace Bu; |
| 8 | 8 | ||
| 9 | int main( int argc, char *argv[] ) | 9 | int main() |
| 10 | { | 10 | { |
| 11 | // Bu::MemBuf mb; | 11 | // Bu::MemBuf mb; |
| 12 | Bu::File mb("store.myr", File::Read|File::Write|File::Create ); | 12 | Bu::File mb("store.myr", File::Read|File::Write|File::Create ); |
diff --git a/src/tests/utf.cpp b/src/tests/utf.cpp index 01bac7e..3418e68 100644 --- a/src/tests/utf.cpp +++ b/src/tests/utf.cpp | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #include <bu/string.h> | 2 | #include <bu/string.h> |
| 3 | #include <bu/utfstring.h> | 3 | #include <bu/utfstring.h> |
| 4 | 4 | ||
| 5 | int main( int argc, char *argv[] ) | 5 | int main() |
| 6 | { | 6 | { |
| 7 | Bu::File fIn("utf8.in", Bu::File::Read ); | 7 | Bu::File fIn("utf8.in", Bu::File::Read ); |
| 8 | Bu::String sUtf8; | 8 | Bu::String sUtf8; |
diff --git a/src/tools/bnfcompile.cpp b/src/tools/bnfcompile.cpp index 011ec84..defb16b 100644 --- a/src/tools/bnfcompile.cpp +++ b/src/tools/bnfcompile.cpp | |||
| @@ -390,6 +390,11 @@ private: | |||
| 390 | 390 | ||
| 391 | int main( int argc, char *argv[] ) | 391 | int main( int argc, char *argv[] ) |
| 392 | { | 392 | { |
| 393 | if( argc < 2 ) | ||
| 394 | { | ||
| 395 | println("Provide an input filename as the first parameter."); | ||
| 396 | return 0; | ||
| 397 | } | ||
| 393 | File fIn( argv[1], File::Read ); | 398 | File fIn( argv[1], File::Read ); |
| 394 | 399 | ||
| 395 | BnfLexer bl( fIn ); | 400 | BnfLexer bl( fIn ); |
diff --git a/src/tools/myriad.cpp b/src/tools/myriad.cpp index 128f20c..30b936c 100644 --- a/src/tools/myriad.cpp +++ b/src/tools/myriad.cpp | |||
| @@ -80,7 +80,7 @@ public: | |||
| 80 | Bu::String sDst; | 80 | Bu::String sDst; |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | Bu::Formatter &operator>>( Bu::Formatter &f, Mode &e ) | 83 | Bu::Formatter &operator>>( Bu::Formatter &f, Mode & /*e*/ ) |
| 84 | { | 84 | { |
| 85 | sio << "Uh oh, the formatter was called..." << sio.nl; | 85 | sio << "Uh oh, the formatter was called..." << sio.nl; |
| 86 | return f; | 86 | return f; |
diff --git a/src/tools/parser.cpp b/src/tools/parser.cpp index aa9e3e4..7d35f12 100644 --- a/src/tools/parser.cpp +++ b/src/tools/parser.cpp | |||
| @@ -227,6 +227,11 @@ void redPrint( Bu::Parser &p ) | |||
| 227 | 227 | ||
| 228 | int main( int argc, char *argv[] ) | 228 | int main( int argc, char *argv[] ) |
| 229 | { | 229 | { |
| 230 | if( argc < 2 ) | ||
| 231 | { | ||
| 232 | println("Provide an input filename as the first parameter."); | ||
| 233 | return 0; | ||
| 234 | } | ||
| 230 | File fIn( argv[1], File::Read ); | 235 | File fIn( argv[1], File::Read ); |
| 231 | 236 | ||
| 232 | Parser p; | 237 | Parser p; |
diff --git a/src/utfstring.cpp b/src/utfstring.cpp index 3f57618..19d3ddc 100644 --- a/src/utfstring.cpp +++ b/src/utfstring.cpp | |||
| @@ -121,7 +121,7 @@ void Bu::UtfString::setUtf8( const Bu::String &sInput ) | |||
| 121 | 121 | ||
| 122 | void Bu::UtfString::setUtf16( const Bu::String &sInput ) | 122 | void Bu::UtfString::setUtf16( const Bu::String &sInput ) |
| 123 | { | 123 | { |
| 124 | Bu::String::const_iterator i = sInput.begin(); | 124 | // Bu::String::const_iterator i = sInput.begin(); |
| 125 | if( (uint8_t)*sInput.begin() == 0xFF && | 125 | if( (uint8_t)*sInput.begin() == 0xFF && |
| 126 | (uint8_t)*(sInput.begin()+1) == 0xFE ) | 126 | (uint8_t)*(sInput.begin()+1) == 0xFE ) |
| 127 | { | 127 | { |
| @@ -311,9 +311,9 @@ void Bu::UtfString::writeUtf8( Bu::Stream &sOut ) | |||
| 311 | // 111 111111 111111 111111 | 311 | // 111 111111 111111 111111 |
| 312 | uByte = (chr>>18)|0xF0; | 312 | uByte = (chr>>18)|0xF0; |
| 313 | sOut.write( &uByte, 1 ); | 313 | sOut.write( &uByte, 1 ); |
| 314 | uByte = (chr>>12)&0x3F|0x80; | 314 | uByte = ((chr>>12)&0x3F)|0x80; |
| 315 | sOut.write( &uByte, 1 ); | 315 | sOut.write( &uByte, 1 ); |
| 316 | uByte = (chr>>6)&0x3F|0x80; | 316 | uByte = ((chr>>6)&0x3F)|0x80; |
| 317 | sOut.write( &uByte, 1 ); | 317 | sOut.write( &uByte, 1 ); |
| 318 | uByte = (chr&0x3F)|0x80; | 318 | uByte = (chr&0x3F)|0x80; |
| 319 | sOut.write( &uByte, 1 ); | 319 | sOut.write( &uByte, 1 ); |
| @@ -324,7 +324,7 @@ void Bu::UtfString::writeUtf8( Bu::Stream &sOut ) | |||
| 324 | // 1111 111111 111111 | 324 | // 1111 111111 111111 |
| 325 | uByte = (chr>>12)|0xE0; | 325 | uByte = (chr>>12)|0xE0; |
| 326 | sOut.write( &uByte, 1 ); | 326 | sOut.write( &uByte, 1 ); |
| 327 | uByte = (chr>>6)&0x3F|0x80; | 327 | uByte = ((chr>>6)&0x3F)|0x80; |
| 328 | sOut.write( &uByte, 1 ); | 328 | sOut.write( &uByte, 1 ); |
| 329 | uByte = (chr&0x3F)|0x80; | 329 | uByte = (chr&0x3F)|0x80; |
| 330 | sOut.write( &uByte, 1 ); | 330 | sOut.write( &uByte, 1 ); |
