You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
(25) |
Apr
(97) |
May
(56) |
Jun
(29) |
Jul
(65) |
Aug
(18) |
Sep
(14) |
Oct
(114) |
Nov
(12) |
Dec
(40) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(44) |
Feb
(47) |
Mar
(109) |
Apr
(114) |
May
(47) |
Jun
(36) |
Jul
(8) |
Aug
(23) |
Sep
(111) |
Oct
(64) |
Nov
(57) |
Dec
(26) |
2004 |
Jan
(2) |
Feb
(18) |
Mar
(11) |
Apr
(1) |
May
(52) |
Jun
(70) |
Jul
(37) |
Aug
(24) |
Sep
(4) |
Oct
(27) |
Nov
(4) |
Dec
(29) |
2005 |
Jan
(8) |
Feb
(36) |
Mar
(71) |
Apr
(31) |
May
(42) |
Jun
(2) |
Jul
(53) |
Aug
(43) |
Sep
(41) |
Oct
(55) |
Nov
(59) |
Dec
(51) |
2006 |
Jan
(36) |
Feb
(36) |
Mar
(19) |
Apr
(85) |
May
(33) |
Jun
(10) |
Jul
(110) |
Aug
(44) |
Sep
(10) |
Oct
(123) |
Nov
(27) |
Dec
|
2007 |
Jan
(34) |
Feb
(16) |
Mar
(21) |
Apr
(53) |
May
(6) |
Jun
(8) |
Jul
(117) |
Aug
(10) |
Sep
(131) |
Oct
(13) |
Nov
(8) |
Dec
(46) |
2008 |
Jan
(47) |
Feb
(44) |
Mar
(66) |
Apr
(2) |
May
(29) |
Jun
(37) |
Jul
(13) |
Aug
(22) |
Sep
(32) |
Oct
(55) |
Nov
(60) |
Dec
(108) |
2009 |
Jan
(23) |
Feb
(103) |
Mar
(98) |
Apr
(21) |
May
(78) |
Jun
(141) |
Jul
(130) |
Aug
(60) |
Sep
(56) |
Oct
(51) |
Nov
(26) |
Dec
(17) |
2010 |
Jan
(48) |
Feb
(49) |
Mar
(42) |
Apr
(123) |
May
(38) |
Jun
(89) |
Jul
(34) |
Aug
(64) |
Sep
(31) |
Oct
(113) |
Nov
(20) |
Dec
(104) |
2011 |
Jan
(110) |
Feb
(70) |
Mar
(43) |
Apr
(30) |
May
(48) |
Jun
(115) |
Jul
(186) |
Aug
(17) |
Sep
(69) |
Oct
(77) |
Nov
(25) |
Dec
(25) |
2012 |
Jan
(49) |
Feb
(9) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ag...@us...> - 2011-11-18 18:38:00
|
Revision: 2611 http://zoolib.svn.sourceforge.net/zoolib/?rev=2611&view=rev Author: agreen Date: 2011-11-18 18:37:54 +0000 (Fri, 18 Nov 2011) Log Message: ----------- Don't need the temp copy of the iterator. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZUtil_STL_vector.h Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_STL_vector.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_STL_vector.h 2011-11-17 14:49:46 UTC (rev 2610) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_STL_vector.h 2011-11-18 18:37:54 UTC (rev 2611) @@ -56,8 +56,7 @@ template <typename Base, typename Derived> bool sPushBackIfNotContains(std::vector<Base>& ioVec, const Derived& iElement) { - typename std::vector<Base>::iterator i = std::find(ioVec.begin(), ioVec.end(), iElement); - if (i != ioVec.end()) + if (ioVec.end() == std::find(ioVec.begin(), ioVec.end(), iElement)) return false; ioVec.push_back(iElement); return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-11-17 14:49:52
|
Revision: 2610 http://zoolib.svn.sourceforge.net/zoolib/?rev=2610&view=rev Author: agreen Date: 2011-11-17 14:49:46 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Make ZYadStrimR_ML publicly available. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZYad_ML.cpp trunk/zoolib/source/cxx/zoolib/ZYad_ML.h Modified: trunk/zoolib/source/cxx/zoolib/ZYad_ML.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_ML.cpp 2011-11-17 14:49:19 UTC (rev 2609) +++ trunk/zoolib/source/cxx/zoolib/ZYad_ML.cpp 2011-11-17 14:49:46 UTC (rev 2610) @@ -59,22 +59,6 @@ #pragma mark - #pragma mark * ZYadStrimR_ML -class ZYadStrimR_ML -: public ZYadStrimR - { -public: - ZYadStrimR_ML(ZRef<ZML::StrimmerU> iStrimmerU); - -// From ZYadR - virtual void Finish(); - -// From ZStrimmerU via ZYadStrimR - virtual const ZStrimR& GetStrimR(); - -private: - ZRef<ZML::StrimmerU> fStrimmerU; - }; - ZYadStrimR_ML::ZYadStrimR_ML(ZRef<ZML::StrimmerU> iStrimmerU) : fStrimmerU(iStrimmerU) {} @@ -85,6 +69,9 @@ const ZStrimR& ZYadStrimR_ML::GetStrimR() { return fStrimmerU->GetStrimR(); } +ZML::StrimU& ZYadStrimR_ML::GetStrim() + { return fStrimmerU->GetStrim(); } + // ================================================================================================= #pragma mark - #pragma mark * ZYadMapR_ML Modified: trunk/zoolib/source/cxx/zoolib/ZYad_ML.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_ML.h 2011-11-17 14:49:19 UTC (rev 2609) +++ trunk/zoolib/source/cxx/zoolib/ZYad_ML.h 2011-11-17 14:49:46 UTC (rev 2610) @@ -40,9 +40,33 @@ // ================================================================================================= #pragma mark - +#pragma mark * ZYadStrimR_ML + +class ZYadStrimR_ML +: public virtual ZYadStrimR + { +public: + ZYadStrimR_ML(ZRef<ZML::StrimmerU> iStrimmerU); + +// From ZYadR + virtual void Finish(); + +// From ZStrimmerU via ZYadStrimR + virtual const ZStrimR& GetStrimR(); + +// Our protocol + ZML::StrimU& GetStrim(); + +private: + ZRef<ZML::StrimmerU> fStrimmerU; + }; + +// ================================================================================================= +#pragma mark - #pragma mark * ZYadMapR_ML -class ZYadMapR_ML : public ZYadMapR_Std +class ZYadMapR_ML +: public virtual ZYadMapR_Std { public: ZYadMapR_ML(ZRef<ZML::StrimmerU> iStrimmerU); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-11-17 14:49:25
|
Revision: 2609 http://zoolib.svn.sourceforge.net/zoolib/?rev=2609&view=rev Author: agreen Date: 2011-11-17 14:49:19 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Use ZSetRestore_T rather than custom class. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp trunk/zoolib/source/cxx/zoolib/ZYad_JSON.h Modified: trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp 2011-11-17 14:48:44 UTC (rev 2608) +++ trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp 2011-11-17 14:49:19 UTC (rev 2609) @@ -19,6 +19,7 @@ ------------------------------------------------------------------------------------------------- */ #include "zoolib/ZCompat_cmath.h" +#include "zoolib/ZSetRestore_T.h" #include "zoolib/ZStrim_Escaped.h" #include "zoolib/ZTime.h" #include "zoolib/ZUnicode.h" @@ -213,7 +214,7 @@ } else if (sTryRead_CaselessString(iStrimU, "null")) { - oVal = ZAny(); + oVal = null; //## Watch this } else if (sTryRead_CaselessString(iStrimU, "false")) { @@ -484,33 +485,6 @@ // ================================================================================================= #pragma mark - -#pragma mark * Visitor_Writer::SaveState - -class Visitor_Writer::SaveState - { -public: - SaveState(Visitor_Writer* iVisitor); - ~SaveState(); - - Visitor_Writer* fVisitor; - size_t fIndent; - bool fMayNeedInitialLF; - }; - -Visitor_Writer::SaveState::SaveState(Visitor_Writer* iVisitor) -: fVisitor(iVisitor), - fIndent(fVisitor->fIndent), - fMayNeedInitialLF(fVisitor->fMayNeedInitialLF) - {} - -Visitor_Writer::SaveState::~SaveState() - { - fVisitor->fIndent = fIndent; - fVisitor->fMayNeedInitialLF = fMayNeedInitialLF; - } - -// ================================================================================================= -#pragma mark - #pragma mark * Visitor_Writer Visitor_Writer::Visitor_Writer @@ -564,8 +538,7 @@ spWriteLFIndent(fStrimW, fIndent, fOptions); } - SaveState save(this); - fMayNeedInitialLF = false; + ZSetRestore_T<bool> theSR_MayNeedInitialLF(fMayNeedInitialLF, false); fStrimW.Write("["); for (bool isFirst = true; /*no test*/ ; isFirst = false) @@ -644,9 +617,8 @@ spWriteString(fStrimW, curName); fStrimW << ": "; - SaveState save(this); - fIndent = fIndent + 1; - fMayNeedInitialLF = true; + ZSetRestore_T<size_t> theSR_Indent(fIndent, fIndent + 1); + ZSetRestore_T<bool> theSR_MayNeedInitialLF(fMayNeedInitialLF, true); cur->Accept(*this); } } @@ -674,7 +646,8 @@ if (fOptions.fBreakStrings) fStrimW.Write(" "); - SaveState save(this); + ZSetRestore_T<size_t> theSR_Indent(fIndent, fIndent + 1); + ZSetRestore_T<bool> theSR_MayNeedInitialLF(fMayNeedInitialLF, true); fIndent = fIndent + 1; fMayNeedInitialLF = true; cur->Accept(*this); Modified: trunk/zoolib/source/cxx/zoolib/ZYad_JSON.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_JSON.h 2011-11-17 14:48:44 UTC (rev 2608) +++ trunk/zoolib/source/cxx/zoolib/ZYad_JSON.h 2011-11-17 14:49:19 UTC (rev 2609) @@ -127,9 +127,6 @@ virtual void Visit_YadMapR(const ZRef<ZYadMapR>& iYadMapR); private: - class SaveState; - friend class SaveState; - size_t fIndent; const ZYadOptions fOptions; const ZStrimW& fStrimW; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-11-17 14:48:50
|
Revision: 2608 http://zoolib.svn.sourceforge.net/zoolib/?rev=2608&view=rev Author: agreen Date: 2011-11-17 14:48:44 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Entity-encode non printing code points. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZML.cpp trunk/zoolib/source/cxx/zoolib/ZML.h Modified: trunk/zoolib/source/cxx/zoolib/ZML.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZML.cpp 2011-11-17 14:47:37 UTC (rev 2607) +++ trunk/zoolib/source/cxx/zoolib/ZML.cpp 2011-11-17 14:48:44 UTC (rev 2608) @@ -434,6 +434,29 @@ return Attrs_t(); } +ZQ<string> StrimU::QAttr(const string& iAttrName) const + { + if (fToken == eToken_Fresh) + this->pAdvance(); + + if (fToken == eToken_TagBegin || fToken == eToken_TagEmpty) + { + for (Attrs_t::const_iterator ii = fTagAttributes.begin(); ii != fTagAttributes.end(); ++ii) + { + if (ii->first == iAttrName) + return ii->second; + } + } + return null; + } + +string StrimU::Attr(const string& iAttrName) const + { + if (ZQ<string> theAttr = this->QAttr(iAttrName)) + return *theAttr; + return string(); + } + // The semantics of this do not precisely match those of other sTryRead_XXX methods. // We will consume code points from \a s up to and including the failing code point. static bool spTryRead_String(const ZStrimR& iStrimR, const string8& iPattern) @@ -866,25 +889,6 @@ iStrim.Write(iString); } -namespace { // anonymous - -struct Entity_t - { - const UTF8* fText; - size_t fLength; - }; - -const Entity_t spEntities[] = - { - { """, 6 }, - { "&", 5 }, - { "<", 4 }, - { ">", 4 }, - { " ", 6 }, - }; - -} // anonymous namespace - void StrimW::Imp_WriteUTF8(const UTF8* iSource, size_t iCountCU, size_t* oCountCU) { this->pPreText(); @@ -894,31 +898,49 @@ for (;;) { // Walk forward through the source till we find a entity CP. - const Entity_t* entity = nullptr; + ZQ<UTF32> theEntityCPQ; const UTF8* current = localSource; const UTF8* priorToEntity; - while (!entity) + while (not theEntityCPQ) { priorToEntity = current; UTF32 theCP; if (not ZUnicode::sReadInc(current, localSourceEnd, theCP)) break; + switch (theCP) { - case '"': entity = &spEntities[0]; break; - case '&': entity = &spEntities[1]; break; - case '<': entity = &spEntities[2]; break; - case '>': entity = &spEntities[3]; break; - case 0x00A0: entity = &spEntities[4]; break; + case '\t': + case '\n': + case '\r': + { + // These whitespace characters are fine + break; + } + case '"': + case '&': + case '<': + case '>': + case 0x00A0: + case 0x007F: + { + theEntityCPQ = theCP; + break; + } + default: + { + if (theCP < 0x20) + theEntityCPQ = theCP; + } } } - size_t countWritten; - if (entity) + if (theEntityCPQ) { // Write everything prior to the entity. if (size_t countToWrite = priorToEntity - localSource) { + size_t countWritten; fStrimSink.Write(localSource, countToWrite, &countWritten); if (!countWritten) break; @@ -933,12 +955,16 @@ } // Write the substitution text. - fStrimSink.Write(entity->fText, entity->fLength, &countWritten); - if (!countWritten) - break; + switch (*theEntityCPQ) + { + case '"': fStrimSink.Write("""); break; + case '&': fStrimSink.Write("&"); break; + case '<': fStrimSink.Write("<"); break; + case '>': fStrimSink.Write(">"); break; + case 0x00A0: fStrimSink.Write(" "); break; + default: fStrimSink.Writef("&#x%02X;", (unsigned int)*theEntityCPQ); + } - // fStrimSink consumed the subsitution text, so advance localSource - // past the entity code point. localSource = current; } else @@ -946,6 +972,7 @@ size_t countToWrite = current - localSource; if (!countToWrite) break; + size_t countWritten; fStrimSink.Write(localSource, countToWrite, &countWritten); if (!countWritten) break; Modified: trunk/zoolib/source/cxx/zoolib/ZML.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZML.h 2011-11-17 14:47:37 UTC (rev 2607) +++ trunk/zoolib/source/cxx/zoolib/ZML.h 2011-11-17 14:48:44 UTC (rev 2608) @@ -86,6 +86,9 @@ const string& Name() const; Attrs_t Attrs() const; + ZQ<string> QAttr(const string& iAttrName) const; + string Attr(const string& iAttrName) const; + private: void pAdvance() const; void pAdvance(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-11-17 14:47:43
|
Revision: 2607 http://zoolib.svn.sourceforge.net/zoolib/?rev=2607&view=rev Author: agreen Date: 2011-11-17 14:47:37 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Allow construction of ZAny from a null. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZAny.h Modified: trunk/zoolib/source/cxx/zoolib/ZAny.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZAny.h 2011-11-17 14:43:37 UTC (rev 2606) +++ trunk/zoolib/source/cxx/zoolib/ZAny.h 2011-11-17 14:47:37 UTC (rev 2607) @@ -53,6 +53,9 @@ ~ZAny(); ZAny& operator=(const ZAny& iOther); + ZAny(const null_t&); + ZAny& operator=(const null_t&); + template <class S> explicit ZAny(const S& iVal) { pCtor_T<S>(iVal); } @@ -382,6 +385,15 @@ return *this; } +inline ZAny::ZAny(const null_t&) + {} + +inline ZAny& ZAny::operator=(const null_t&) + { + this->Clear(); + return *this; + } + template <class S> inline ZAny& ZAny::operator=(const S& iVal) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-11-17 14:43:44
|
Revision: 2606 http://zoolib.svn.sourceforge.net/zoolib/?rev=2606&view=rev Author: agreen Date: 2011-11-17 14:43:37 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Remove sCog. Add sCog_Not. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCog.h Modified: trunk/zoolib/source/cxx/zoolib/ZCog.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-11-14 15:06:44 UTC (rev 2605) +++ trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-11-17 14:43:37 UTC (rev 2606) @@ -97,48 +97,6 @@ // ================================================================================================= #pragma mark - -#pragma mark * sCog function and pseudo operator - -#if 0 - -const struct - { - template <class Param> - ZCog<Param> operator() - (ZCallable<ZCog<Param>(const ZCog<Param>&,Param)>* iCallable) const - { return iCallable; } - - template <class Param> - ZCog<Param> operator() - (const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable) const - { return iCallable; } - - template <class Param> - const ZCog<Param>& operator() - (const ZCog<Param>& iCog) const - { return iCog; } - - template <class Param> - ZCog<Param> operator& - (ZCallable<ZCog<Param>(const ZCog<Param>&,Param)>* iCallable) const - { return iCallable; } - - template <class Param> - ZCog<Param> operator& - (const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable) const - { return iCallable; } - - template <class Param> - const ZCog<Param>& operator& - (const ZCog<Param>& iCog) const - { return iCog; } - - } sCog = {}; - -#endif - -// ================================================================================================= -#pragma mark - #pragma mark * sCog_Term template <class Param> @@ -214,6 +172,36 @@ // ================================================================================================= #pragma mark - +#pragma mark * sCog_Not + +template <class Param> +ZCog<Param> spCogFun_Not(const ZCog<Param>& iSelf, Param iParam, + const ZCog<Param>& iCog) + { + if (iCog && not sIsTerm(iCog)) + { + const ZCog<Param> newCog = iCog->Call(iCog, iParam); + if (not newCog || sIsTerm(newCog)) + return iCog; + } + return iSelf; + } + +template <class Param> +const ZCog<Param>& sCog_Not + (const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable) + { + static ZMACRO_auto(spCallable, sCallable(spCogFun_Not<Param>)); + return sBindR(spCallable, iCallable); + } + +template <class Param> +ZCog<Param> operator~ + (const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable) + { return sCog_Not<Param>(iCallable); } + +// ================================================================================================= +#pragma mark - #pragma mark * sCog_Either template <class Param> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-11-14 15:06:51
|
Revision: 2605 http://zoolib.svn.sourceforge.net/zoolib/?rev=2605&view=rev Author: agreen Date: 2011-11-14 15:06:44 +0000 (Mon, 14 Nov 2011) Log Message: ----------- Conform to other changes. Modified Paths: -------------- trunk/zoolib_samples/YadTranscode/src/YadTranscode.cpp Modified: trunk/zoolib_samples/YadTranscode/src/YadTranscode.cpp =================================================================== --- trunk/zoolib_samples/YadTranscode/src/YadTranscode.cpp 2011-11-09 17:14:49 UTC (rev 2604) +++ trunk/zoolib_samples/YadTranscode/src/YadTranscode.cpp 2011-11-14 15:06:44 UTC (rev 2605) @@ -75,38 +75,33 @@ // ================================================================================================= -static ZRef<ZStreamerW> sOpenStreamerW(const string& iPath) +static ZRef<ZStreamerW> spOpenStreamerW(const string& iPath) { if (iPath == "-") { return new ZStreamerW_T<ZStreamW_FILE>(stdout); } - else + else if (ZRef<ZStreamerWPos> theStreamerWPos = ZFileSpec(iPath).CreateWPos(true, false)) { - if (ZRef<ZStreamerWPos> theStreamerWPos = ZFileSpec(iPath).CreateWPos(true, false)) - { - const ZStreamWPos& theStreamWPos = theStreamerWPos->GetStreamWPos(); - theStreamWPos.SetSize(0); - return theStreamerWPos; - } + theStreamerWPos->GetStreamWPos().SetSize(0); + return theStreamerWPos; } - return ZRef<ZStreamerW>(); + + return null; } -static ZRef<ZStreamerR> sOpenStreamerR(const string& iPath) +static ZRef<ZStreamerR> spOpenStreamerR(const string& iPath) { if (iPath == "-") { return new ZStreamerR_T<ZStreamR_FILE>(stdin); } - else + else if (ZRef<ZStreamerR> theStreamerR = ZFileSpec(iPath).OpenR()) { - if (ZRef<ZStreamerR> theStreamerR = ZFileSpec(iPath).OpenR()) - { - return theStreamerR; - } + return theStreamerR; } - return ZRef<ZStreamerR>(); + + return null; } // ================================================================================================= @@ -135,14 +130,14 @@ return 0; } - ZRef<ZStreamerR> theStreamerR = sOpenStreamerR(cmd.fIF()); + ZRef<ZStreamerR> theStreamerR = spOpenStreamerR(cmd.fIF()); if (!theStreamerR) { serr << "Couldn't open input file\n"; return 1; } - ZRef<ZStreamerW> theStreamerW = sOpenStreamerW(cmd.fOF()); + ZRef<ZStreamerW> theStreamerW = spOpenStreamerW(cmd.fOF()); if (!theStreamerW) { serr << "Couldn't open output file\n"; @@ -155,6 +150,7 @@ try { ZRef<ZStreamerR> theStreamerR_Buffered = new ZStreamerR_Buffered(4096, theStreamerR); +// ZRef<ZStreamerR> theStreamerR_Buffered = theStreamerR; ZRef<ZStreamerU> theStreamerU_Unreader = new ZStreamerU_FT<ZStreamU_Unreader>(theStreamerR_Buffered); @@ -171,11 +167,11 @@ {} else if (cmd.fIT() == "bencode") { - theYadR = ZYad_Bencode::sMakeYadR(theStreamerU_Unreader); + theYadR = ZYad_Bencode::sYadR(theStreamerU_Unreader); } else if (cmd.fIT() == "json") { - theYadR = ZYad_JSON::sMakeYadR(theStrimmerU_Unreader); + theYadR = ZYad_JSON::sYadR(theStrimmerU_Unreader); } else if (cmd.fIT() == "ml") { @@ -184,19 +180,19 @@ else if (cmd.fIT() == "quicktime") { theYadOptions.fRawSizeCap = 256; - theYadR = FileFormat::QuickTime::sMakeYadR(theStreamerR);//theStreamerR_Buffered); + theYadR = FileFormat::QuickTime::sYadR(theStreamerR);//theStreamerR_Buffered); } else if (cmd.fIT() == "xmlattr") { - theYadR = ZYad_XMLAttr::sMakeYadR(theStrimmerU_ML); + theYadR = ZYad_XMLAttr::sYadR(theStrimmerU_ML); } else if (cmd.fIT() == "xmlplist") { - theYadR = ZYad_XMLPList::sMakeYadR(theStrimmerU_ML); + theYadR = ZYad_XMLPList::sYadR(theStrimmerU_ML); } else if (cmd.fIT() == "zstream") { - theYadR = ZYad_ZooLibStream::sMakeYadR(theStreamerR_Buffered); + theYadR = ZYad_ZooLibStream::sYadR(theStreamerR_Buffered); } else if (cmd.fIT() == "zstreamtuple") { @@ -204,11 +200,11 @@ } else if (cmd.fIT() == "zstrim") { - theYadR = ZYad_ZooLibStrim::sMakeYadR(theStrimmerU_Unreader); + theYadR = ZYad_ZooLibStrim::sYadR(theStrimmerU_Unreader); } else if (cmd.fIT() == "tabcr") { - theYadR = ZYad_DividedValues::sMakeYadR('\t', '\n', theStrimmerR_StreamUTF8); + theYadR = ZYad_DividedValues::sYadR('\t', '\n', theStrimmerR_StreamUTF8); } else { @@ -222,34 +218,19 @@ return 1; } -// ZStreamW_Buffered theStreamW(1*1024, theStreamerW->GetStreamW()); - const ZStreamW& theStreamW(theStreamerW->GetStreamW()); + const ZStreamW& theStreamW = theStreamerW->GetStreamW(); if (false) {} else if (cmd.fOT() == "json") { - ZYad_JSON::sToStrim(0, theYadOptions, - theYadR, ZStrimW_StreamUTF8(theStreamW)); + ZYad_JSON::sToStrim(0, theYadOptions, theYadR, ZStrimW_StreamUTF8(theStreamW)); } else if (cmd.fOT() == "xmlplist") { ZStrimW_StreamUTF8 theStrimW(theStreamW); ZML::StrimW theStrimW_ML(theStrimW); - - theStrimW_ML.PI("xml"); - theStrimW_ML.Attr("version", "1.0"); - theStrimW_ML.Attr("encoding", "UTF-8"); - - theStrimW_ML.Tag("!DOCTYPE"); - theStrimW_ML.Attr("plist"); - theStrimW_ML.Attr("PUBLIC"); - theStrimW_ML.Attr("\"-//Apple Computer//DTD PLIST 1.0//EN\""); - theStrimW_ML.Attr("\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\""); - - theStrimW_ML.Tag("plist"); - theStrimW_ML.Attr("version", "1.0"); - + ZYad_XMLPList::sWritePreamble(theStrimW_ML); ZYad_XMLPList::sToStrim(theYadR, theStrimW_ML); } else if (cmd.fOT() == "zstream") @@ -262,8 +243,7 @@ } else if (cmd.fOT() == "zstrim") { - ZYad_ZooLibStrim::sToStrim(0, theYadOptions, - theYadR, ZStrimW_StreamUTF8(theStreamW)); + ZYad_ZooLibStrim::sToStrim(0, theYadOptions, theYadR, ZStrimW_StreamUTF8(theStreamW)); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-11-09 17:14:55
|
Revision: 2604 http://zoolib.svn.sourceforge.net/zoolib/?rev=2604&view=rev Author: agreen Date: 2011-11-09 17:14:49 +0000 (Wed, 09 Nov 2011) Log Message: ----------- Add sShear. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/gameengine/ZGameEngine_Geometry.h Modified: trunk/zoolib/source/cxx/more/zoolib/gameengine/ZGameEngine_Geometry.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/gameengine/ZGameEngine_Geometry.h 2011-10-31 20:28:34 UTC (rev 2603) +++ trunk/zoolib/source/cxx/more/zoolib/gameengine/ZGameEngine_Geometry.h 2011-11-09 17:14:49 UTC (rev 2604) @@ -203,8 +203,8 @@ template <class Val> ZMatrix<Val,4,4> sRotateX(Val radians) { - Val s = sin(radians); - Val c = cos(radians); + const Val s = sin(radians); + const Val c = cos(radians); ZMatrix<Val,4,4> result; result.fE[0][0] = 1; result.fE[1][1] = c; @@ -222,8 +222,8 @@ template <class Val> ZMatrix<Val,4,4> sRotateY(Val radians) { - Val s = sin(radians); - Val c = cos(radians); + const Val s = sin(radians); + const Val c = cos(radians); ZMatrix<Val,4,4> result; result.fE[0][0] = c; result.fE[1][1] = 1; @@ -241,8 +241,8 @@ template <class Val> ZMatrix<Val,4,4> sRotateZ(Val radians) { - Val s = sin(radians); - Val c = cos(radians); + const Val s = sin(radians); + const Val c = cos(radians); ZMatrix<Val,4,4> result; result.fE[0][0] = c; result.fE[0][1] = s; @@ -253,6 +253,36 @@ return result; } +// ================================================================================================= +#pragma mark - +#pragma mark * sShear + +template <class Val> +ZMatrix<Val,4,4> sShear(Val xy, Val xz, Val yx, Val yz, Val zx, Val zy) + { + ZMatrix<Val,4,4> result(null); + result.fE[0][0] = 1; + result.fE[0][1] = xy; + result.fE[0][2] = xz; + result.fE[0][3] = 0; + + result.fE[1][0] = yx; + result.fE[1][1] = 1; + result.fE[1][2] = yz; + result.fE[1][3] = 0; + + result.fE[2][0] = zx; + result.fE[2][1] = zy; + result.fE[2][2] = 1; + result.fE[2][3] = 0; + + result.fE[3][0] = 0; + result.fE[3][1] = 0; + result.fE[3][2] = 0; + result.fE[3][3] = 1; + return result; + } + } // namespace ZGameEngine } // namespace ZooLib This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-31 20:28:40
|
Revision: 2603 http://zoolib.svn.sourceforge.net/zoolib/?rev=2603&view=rev Author: agreen Date: 2011-10-31 20:28:34 +0000 (Mon, 31 Oct 2011) Log Message: ----------- Fix comment Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZMatrix.h Modified: trunk/zoolib/source/cxx/zoolib/ZMatrix.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZMatrix.h 2011-10-31 20:26:42 UTC (rev 2602) +++ trunk/zoolib/source/cxx/zoolib/ZMatrix.h 2011-10-31 20:28:34 UTC (rev 2603) @@ -27,7 +27,7 @@ namespace ZooLib { // For compatibility with OpenGL we store in column-major order. -// Matrices are specified as the number of rows, then the number of columns. +// Matrices are specified as the number of columns, then the number of rows. // ================================================================================================= #pragma mark - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-31 20:26:48
|
Revision: 2602 http://zoolib.svn.sourceforge.net/zoolib/?rev=2602&view=rev Author: agreen Date: 2011-10-31 20:26:42 +0000 (Mon, 31 Oct 2011) Log Message: ----------- An annoying but neccessary change in the order of ZMatrix template parameters, so that the template params and the storage array indices are in the same order, making the code much less confusing. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/gameengine/ZGameEngine_Geometry.h trunk/zoolib/source/cxx/zoolib/ZMatrix.h trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Matrix.h Modified: trunk/zoolib/source/cxx/more/zoolib/gameengine/ZGameEngine_Geometry.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/gameengine/ZGameEngine_Geometry.h 2011-10-31 03:11:56 UTC (rev 2601) +++ trunk/zoolib/source/cxx/more/zoolib/gameengine/ZGameEngine_Geometry.h 2011-10-31 20:26:42 UTC (rev 2602) @@ -40,18 +40,18 @@ } template <class Val> -ZMatrix<Val,2,1> sCVec(Val i0, Val i1) +ZMatrix<Val,1,2> sCVec(Val i0, Val i1) { - ZMatrix<Val,2,1> result; + ZMatrix<Val,1,2> result; result.fE[0][0] = i0; result.fE[0][1] = i1; return result; } template <class Val> -ZMatrix<Val,3,1> sCVec(Val i0, Val i1, Val i2) +ZMatrix<Val,1,3> sCVec(Val i0, Val i1, Val i2) { - ZMatrix<Val,3,1> result; + ZMatrix<Val,1,3> result; result.fE[0][0] = i0; result.fE[0][1] = i1; result.fE[0][2] = i2; @@ -59,9 +59,9 @@ } template <class Val> -ZMatrix<Val,4,1> sCVec(Val i0, Val i1, Val i2, Val i3) +ZMatrix<Val,1,4> sCVec(Val i0, Val i1, Val i2, Val i3) { - ZMatrix<Val,4,1> result; + ZMatrix<Val,1,4> result; result.fE[0][0] = i0; result.fE[0][1] = i1; result.fE[0][2] = i2; @@ -74,16 +74,16 @@ #pragma mark * CVec3 ctors template <class Val> -ZMatrix<Val,3,1> sCVec3(Val x, Val y, Val z) +ZMatrix<Val,1,3> sCVec3(Val x, Val y, Val z) { return sCVec(x, y, z); } template <class Val> -ZMatrix<Val,3,1> sCVec3(Val iVal) +ZMatrix<Val,1,3> sCVec3(Val iVal) { return sCVec3(iVal, iVal, iVal); } template <class Val> -ZMatrix<Val,3,1> sCVec3() - { return ZMatrix<Val,3,1>(); } +ZMatrix<Val,1,3> sCVec3() + { return ZMatrix<Val,1,3>(); } // ================================================================================================= #pragma mark - @@ -98,7 +98,7 @@ } template <class Val> -ZMatrix<Val,1,2> sRVec(Val i0, Val i1) +ZMatrix<Val,2,1> sRVec(Val i0, Val i1) { ZMatrix<Val,1,2> result; result.fE[0][0] = i0; @@ -107,7 +107,7 @@ } template <class Val> -ZMatrix<Val,1,3> sRVec(Val i0, Val i1, Val i2) +ZMatrix<Val,3,1> sRVec(Val i0, Val i1, Val i2) { ZMatrix<Val,1,3> result; result.fE[0][0] = i0; @@ -117,7 +117,7 @@ } template <class Val> -ZMatrix<Val,1,4> sRVec(Val i0, Val i1, Val i2, Val i3) +ZMatrix<Val,4,1> sRVec(Val i0, Val i1, Val i2, Val i3) { ZMatrix<Val,1,4> result; result.fE[0][0] = i0; @@ -132,16 +132,16 @@ #pragma mark * RVec3 ctors template <class Val> -ZMatrix<Val,1,3> sRVec3(Val x, Val y, Val z) +ZMatrix<Val,3,1> sRVec3(Val x, Val y, Val z) { return sRVec(x, y, z); } template <class Val> -ZMatrix<Val,1,3> sRVec3(Val iVal) +ZMatrix<Val,3,1> sRVec3(Val iVal) { return sRVec3(iVal, iVal, iVal); } template <class Val> -ZMatrix<Val,1,3> sRVec3() - { return ZMatrix<Val,1,3>(); } +ZMatrix<Val,3,1> sRVec3() + { return ZMatrix<Val,3,1>(); } // ================================================================================================= #pragma mark - Modified: trunk/zoolib/source/cxx/zoolib/ZMatrix.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZMatrix.h 2011-10-31 03:11:56 UTC (rev 2601) +++ trunk/zoolib/source/cxx/zoolib/ZMatrix.h 2011-10-31 20:26:42 UTC (rev 2602) @@ -33,9 +33,9 @@ #pragma mark - #pragma mark * ZMatrix -template <class E, size_t R, size_t C> class ZMatrix; +template <class E, size_t C, size_t R> class ZMatrix; -template <class E_p, size_t R_p, size_t C_p> +template <class E_p, size_t C_p, size_t R_p> class ZMatrix { public: @@ -88,7 +88,7 @@ #pragma mark * ZMatrix, specialized for column vector template <class E_p, size_t R_p> -class ZMatrix<E_p, R_p, 1> +class ZMatrix<E_p,1,R_p> { public: typedef E_p E; @@ -136,7 +136,7 @@ #pragma mark * ZMatrix, specialized for row vector template <class E_p, size_t C_p> -class ZMatrix<E_p, 1, C_p> +class ZMatrix<E_p,C_p,1> { public: typedef E_p E; @@ -184,9 +184,9 @@ #pragma mark * sHomogenous (column vector) template <class E, size_t R> -ZMatrix<E,R+1,1> sHomogenous(const ZMatrix<E,R,1>& iMat) +ZMatrix<E,1,R+1> sHomogenous(const ZMatrix<E,1,R>& iMat) { - ZMatrix<E,R+1,1> result; + ZMatrix<E,1,R+1> result; for (size_t r = 0; r < R; ++r) result.fE[0][r] = iMat.fE[0][r]; result.fE[0][R] = 1; @@ -198,9 +198,9 @@ #pragma mark * sHomogenous (row vector) template <class E, size_t C> -ZMatrix<E,1,C+1> sHomogenous(const ZMatrix<E,1,C>& iMat) +ZMatrix<E,C+1,1> sHomogenous(const ZMatrix<E,C,1>& iMat) { - ZMatrix<E,1,C+1> result; + ZMatrix<E,C+1,1> result; for (size_t c = 0; c < C; ++c) result.fE[c][0] = iMat.fE[c][0]; result.fE[C][0] = 1; @@ -212,9 +212,9 @@ #pragma mark * sCartesian (column vector) template <class E, size_t R> -ZMatrix<E,R-1,1> sCartesian(const ZMatrix<E,R,1>& iMat) +ZMatrix<E,1,R-1> sCartesian(const ZMatrix<E,1,R>& iMat) { - ZMatrix<E,R-1,1> result; + ZMatrix<E,1,R-1> result; for (size_t r = 0; r < R - 1; ++r) result.fE[0][r] = iMat.fE[0][r]; return result; @@ -225,9 +225,9 @@ #pragma mark * sCartesian (row vector) template <class E, size_t C> -ZMatrix<E,1,C-1> sCartesian(const ZMatrix<E,1,C>& iMat) +ZMatrix<E,C-1,1> sCartesian(const ZMatrix<E,C,1>& iMat) { - ZMatrix<E,1,C-1> result; + ZMatrix<E,C-1,1> result; for (size_t c = 0; c < C - 1; ++c) result.fE[c][0] = iMat.fE[c][0]; return result; @@ -238,7 +238,7 @@ #pragma mark * sDot (column vector) template <class E, size_t R> -E sDot(const ZMatrix<E,R,1>& i0, const ZMatrix<E,R,1>& i1) +E sDot(const ZMatrix<E,1,R>& i0, const ZMatrix<E,1,R>& i1) { E result = 0; for (size_t r = 0; r < R; ++r) @@ -251,7 +251,7 @@ #pragma mark * sDot (row vector) template <class E, size_t C> -E sDot(const ZMatrix<E,1,C>& i0, const ZMatrix<E,1,C>& i1) +E sDot(const ZMatrix<E,C,1>& i0, const ZMatrix<E,C,1>& i1) { E result = 0; for (size_t c = 0; c < C; ++c) @@ -264,9 +264,9 @@ #pragma mark * sCross (column vector) template <class E, size_t R> -ZMatrix<E,R,1> sCross(const ZMatrix<E,R,1>& i0, const ZMatrix<E,R,1>& i1) +ZMatrix<E,1,R> sCross(const ZMatrix<E,1,R>& i0, const ZMatrix<E,1,R>& i1) { - ZMatrix<E,R,1> result; + ZMatrix<E,1,R> result; for (size_t r = 0; r < R; ++r) { for (size_t r0 = 0; r0 < R; ++r0) @@ -289,9 +289,9 @@ #pragma mark * sCross (row vector) template <class E, size_t C> -ZMatrix<E,1,C> sCross(const ZMatrix<E,1,C>& i0, const ZMatrix<E,1,C>& i1) +ZMatrix<E,C,1> sCross(const ZMatrix<E,C,1>& i0, const ZMatrix<E,C,1>& i1) { - ZMatrix<E,1,C> result; + ZMatrix<E,C,1> result; for (size_t c = 0; c < C; ++c) { for (size_t c0 = 0; c0 < C; ++c0) @@ -330,7 +330,7 @@ #pragma mark - #pragma mark * sTransposed -template <class E, size_t R, size_t C> +template <class E, size_t C, size_t R> ZMatrix<E,C,R> sTransposed(const ZMatrix<E,R,C>& iMat) { ZMatrix<E,C,R> result; @@ -347,7 +347,7 @@ #pragma mark * sLengthSquared (column vector) template <class E, size_t R> -E sLengthSquared(const ZMatrix<E,R,1>& iVec) +E sLengthSquared(const ZMatrix<E,1,R>& iVec) { return sDot(iVec, iVec); } // ================================================================================================= @@ -355,7 +355,7 @@ #pragma mark * sLengthSquared (row vector) template <class E, size_t C> -E sLengthSquared(const ZMatrix<E,1,C>& iVec) +E sLengthSquared(const ZMatrix<E,C,1>& iVec) { return sDot(iVec, iVec); } // ================================================================================================= @@ -363,7 +363,7 @@ #pragma mark * sLength (column vector) template <class E, size_t R> -E sLength(const ZMatrix<E,R,1>& iVec) +E sLength(const ZMatrix<E,1,R>& iVec) { return sqrt(sLengthSquared(iVec)); } // ================================================================================================= @@ -371,7 +371,7 @@ #pragma mark * sLength (row vector) template <class E, size_t C> -E sLength(const ZMatrix<E,1,C>& iVec) +E sLength(const ZMatrix<E,C,1>& iVec) { return sqrt(sLengthSquared(iVec)); } // ================================================================================================= @@ -379,11 +379,11 @@ #pragma mark * sNormalized (row vector) template <class E, size_t C> -ZMatrix<E,1,C> sNormalized(const ZMatrix<E,1,C>& iVec) +ZMatrix<E,C,1> sNormalized(const ZMatrix<E,C,1>& iVec) { const E length = sLength(iVec); ZAssert(length > 0); - ZMatrix<E,1,C> result(null); + ZMatrix<E,C,1> result(null); for (size_t c = 0; c < C; ++c) result.fE[c][0] = iVec.fE[c][0] / length; return result; @@ -394,11 +394,11 @@ #pragma mark * sNormalized (column vector) template <class E, size_t R> -ZMatrix<E,R,1> sNormalized(const ZMatrix<E,R,1>& iVec) +ZMatrix<E,1,R> sNormalized(const ZMatrix<E,1,R>& iVec) { const E length = sLength(iVec); ZAssert(length > 0); - ZMatrix<E,R,1> result(null); + ZMatrix<E,1,R> result(null); for (size_t r = 0; r < R; ++r) result.fE[0][r] = iVec.fE[0][r] / length; return result; @@ -408,10 +408,10 @@ #pragma mark - #pragma mark * sApply (binary function) -template <class Fun, class E, size_t R, size_t C> -ZMatrix<E,R,C> sApply(Fun iFun, const ZMatrix<E,R,C>& i0, const ZMatrix<E,R,C>& i1) +template <class Fun, class E, size_t C, size_t R> +ZMatrix<E,C,R> sApply(Fun iFun, const ZMatrix<E,C,R>& i0, const ZMatrix<E,C,R>& i1) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -424,10 +424,10 @@ #pragma mark - #pragma mark * sApply (unary function) -template <class Fun, class E, size_t R, size_t C> -ZMatrix<E,R,C> sApply(Fun iFun, const ZMatrix<E,R,C>& iMat) +template <class Fun, class E, size_t C, size_t R> +ZMatrix<E,C,R> sApply(Fun iFun, const ZMatrix<E,C,R>& iMat) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -440,10 +440,10 @@ #pragma mark - #pragma mark * sNonZero -template <class E, size_t R, size_t C> -ZMatrix<E,R,C> sNonZero(const ZMatrix<E,R,C>& iMat) +template <class E, size_t C, size_t R> +ZMatrix<E,C,R> sNonZero(const ZMatrix<E,C,R>& iMat) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -457,9 +457,9 @@ #pragma mark * Multiplication (aka composition) template <class E, size_t RL, size_t Common, size_t CR> -ZMatrix<E,RL,CR> operator*(const ZMatrix<E,RL,Common>& iLeft, const ZMatrix<E,Common,CR>& iRight) +ZMatrix<E,CR, RL> operator*(const ZMatrix<E,Common,RL>& iLeft, const ZMatrix<E,CR,Common>& iRight) { - ZMatrix<E,RL,CR> result; + ZMatrix<E,CR,RL> result; for (size_t rl = 0; rl < RL; ++rl) { for (size_t cr = 0; cr < CR; ++cr) @@ -471,30 +471,30 @@ return result; } -template <class E, size_t RL, size_t Common, size_t CR> -ZMatrix<E,RL,CR>& operator*=(ZMatrix<E,RL,Common>& ioLeft, const ZMatrix<E,Common,CR>& iRight) +template <class E, size_t CR, size_t Common, size_t RL> +ZMatrix<E,CR,RL>& operator*=(ZMatrix<E,Common,RL>& ioLeft, const ZMatrix<E,CR,Common>& iRight) { return ioLeft = ioLeft * iRight; } // ================================================================================================= #pragma mark - #pragma mark * Composition -template <class E, size_t RL, size_t Common> -ZMatrix<E,Common,1> operator*(const ZMatrix<E,RL,Common+1>& iLeft, const ZMatrix<E,Common,1>& iRight) +template <class E, size_t Common, size_t RL> +ZMatrix<E,1,Common> operator*(const ZMatrix<E,Common+1,RL>& iLeft, const ZMatrix<E,1,Common>& iRight) { return sCartesian(iLeft * sHomogenous(iRight)); } -template <class E, size_t RL, size_t Common> -ZMatrix<E,Common,1>& operator*=(ZMatrix<E,RL,Common+1>& ioLeft, const ZMatrix<E,Common,1>& iRight) +template <class E, size_t Common, size_t RL> +ZMatrix<E,1,Common>& operator*=(ZMatrix<E,Common+1,RL>& ioLeft, const ZMatrix<E,1,Common>& iRight) { return ioLeft = ioLeft * iRight; } // ================================================================================================= #pragma mark - #pragma mark * Element-by-element multiplication -template <class E, size_t R, size_t C> -ZMatrix<E,R,C> sTimes(const ZMatrix<E,R,C>& iLeft, const ZMatrix<E,R,C>& iRight) +template <class E, size_t C, size_t R> +ZMatrix<E,C,R> sTimes(const ZMatrix<E,C,R>& iLeft, const ZMatrix<E,C,R>& iRight) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -507,10 +507,10 @@ #pragma mark - #pragma mark * Addition -template <class E, size_t R, size_t C> -ZMatrix<E,R,C> operator+(const ZMatrix<E,R,C>& iLeft, const ZMatrix<E,R,C>& iRight) +template <class E, size_t C, size_t R> +ZMatrix<E,C,R> operator+(const ZMatrix<E,C,R>& iLeft, const ZMatrix<E,C,R>& iRight) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -519,8 +519,8 @@ return result; } -template <class E, size_t R, size_t C> -ZMatrix<E,R,C>& operator+=(ZMatrix<E,R,C>& ioLeft, const ZMatrix<E,R,C>& iRight) +template <class E, size_t C, size_t R> +ZMatrix<E,C,R>& operator+=(ZMatrix<E,C,R>& ioLeft, const ZMatrix<E,C,R>& iRight) { for (size_t c = 0; c < C; ++c) { @@ -534,10 +534,10 @@ #pragma mark - #pragma mark * Subtraction -template <class E, size_t R, size_t C> -ZMatrix<E,R,C> operator-(const ZMatrix<E,R,C>& iLeft, const ZMatrix<E,R,C>& iRight) +template <class E, size_t C, size_t R> +ZMatrix<E,C,R> operator-(const ZMatrix<E,C,R>& iLeft, const ZMatrix<E,C,R>& iRight) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -546,8 +546,8 @@ return result; } -template <class E, size_t R, size_t C> -ZMatrix<E,R,C>& operator-=(ZMatrix<E,R,C>& ioLeft, const ZMatrix<E,R,C>& iRight) +template <class E, size_t C, size_t R> +ZMatrix<E,C,R>& operator-=(ZMatrix<E,C,R>& ioLeft, const ZMatrix<E,C,R>& iRight) { for (size_t c = 0; c < C; ++c) { @@ -561,10 +561,10 @@ #pragma mark - #pragma mark * Negate -template <class E, size_t R, size_t C> -ZMatrix<E,R,C> operator-(const ZMatrix<E,R,C>& iMat) +template <class E, size_t C, size_t R> +ZMatrix<E,C,R> operator-(const ZMatrix<E,C,R>& iMat) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -577,10 +577,10 @@ #pragma mark - #pragma mark * Scalar multiplication -template <class E, size_t R, size_t C, class T> -ZMatrix<E,R,C> operator*(const ZMatrix<E,R,C>& iLeft, T iRight) +template <class E, size_t C, size_t R, class T> +ZMatrix<E,C,R> operator*(const ZMatrix<E,C,R>& iLeft, T iRight) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -589,8 +589,8 @@ return result; } -template <class E, size_t R, size_t C, class T> -ZMatrix<E,R,C>& operator*=(ZMatrix<E,R,C>& ioLeft, T iRight) +template <class E, size_t C, size_t R, class T> +ZMatrix<E,C,R>& operator*=(ZMatrix<E,C,R>& ioLeft, T iRight) { for (size_t c = 0; c < C; ++c) { @@ -604,10 +604,10 @@ #pragma mark - #pragma mark * Scalar division -template <class E, size_t R, size_t C, class T> -ZMatrix<E,R,C> operator/(const ZMatrix<E,R,C>& iLeft, T iRight) +template <class E, size_t C, size_t R, class T> +ZMatrix<E,C,R> operator/(const ZMatrix<E,C,R>& iLeft, T iRight) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -616,8 +616,8 @@ return result; } -template <class E, size_t R, size_t C, class T> -ZMatrix<E,R,C>& operator/=(ZMatrix<E,R,C>& ioLeft, T iRight) +template <class E, size_t C, size_t R, class T> +ZMatrix<E,C,R>& operator/=(ZMatrix<E,C,R>& ioLeft, T iRight) { for (size_t c = 0; c < C; ++c) { @@ -631,10 +631,10 @@ #pragma mark - #pragma mark * Scalar addition -template <class E, size_t R, size_t C, class T> -ZMatrix<E,R,C> operator+(const ZMatrix<E,R,C>& iLeft, T iRight) +template <class E, size_t C, size_t R, class T> +ZMatrix<E,C,R> operator+(const ZMatrix<E,C,R>& iLeft, T iRight) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -643,8 +643,8 @@ return result; } -template <class E, size_t R, size_t C, class T> -ZMatrix<E,R,C>& operator+=(ZMatrix<E,R,C>& ioLeft, T iRight) +template <class E, size_t C, size_t R, class T> +ZMatrix<E,C,R>& operator+=(ZMatrix<E,C,R>& ioLeft, T iRight) { for (size_t c = 0; c < C; ++c) { @@ -658,10 +658,10 @@ #pragma mark - #pragma mark * Scalar subtraction -template <class E, size_t R, size_t C, class T> -ZMatrix<E,R,C> operator-(const ZMatrix<E,R,C>& iLeft, T iRight) +template <class E, size_t C, size_t R, class T> +ZMatrix<E,C,R> operator-(const ZMatrix<E,C,R>& iLeft, T iRight) { - ZMatrix<E,R,C> result(null); + ZMatrix<E,C,R> result(null); for (size_t c = 0; c < C; ++c) { for (size_t r = 0; r < R; ++r) @@ -670,8 +670,8 @@ return result; } -template <class E, size_t R, size_t C, class T> -ZMatrix<E,R,C>& operator-=(ZMatrix<E,R,C>& ioLeft, T iRight) +template <class E, size_t C, size_t R, class T> +ZMatrix<E,C,R>& operator-=(ZMatrix<E,C,R>& ioLeft, T iRight) { for (size_t c = 0; c < C; ++c) { @@ -686,7 +686,7 @@ #pragma mark * sScale (taking column vector) template <class E, size_t Dim> -ZMatrix<E,Dim+1,Dim+1> sScale(const ZMatrix<E,Dim,1>& iVec) +ZMatrix<E,Dim+1,Dim+1> sScale(const ZMatrix<E,1,Dim>& iVec) { ZMatrix<E,Dim+1,Dim+1> result; for (size_t ii = 0; ii < Dim; ++ii) @@ -700,7 +700,7 @@ #pragma mark * sTranslate (taking column vector) template <class E, size_t Dim> -ZMatrix<E,Dim+1,Dim+1> sTranslate(const ZMatrix<E,Dim,1>& iVec) +ZMatrix<E,Dim+1,Dim+1> sTranslate(const ZMatrix<E,1,Dim>& iVec) { ZMatrix<E,Dim+1,Dim+1> result = sIdentity<E,Dim+1>(); for (size_t ii = 0; ii < Dim; ++ii) Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Matrix.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Matrix.h 2011-10-31 03:11:56 UTC (rev 2601) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_Strim_Matrix.h 2011-10-31 20:26:42 UTC (rev 2602) @@ -28,35 +28,35 @@ namespace ZooLib { template <class E, size_t R> -const ZStrimW& operator<<(const ZStrimW& w, const ZMatrix<E,R,1>& mat) +const ZStrimW& operator<<(const ZStrimW& w, const ZMatrix<E,1,R>& mat) { w << "C["; for (size_t r = 0; r < R; ++r) { if (r) w << ", "; - w << mat.fE[r][0]; + w << mat.fE[0][r]; } w << "]"; return w; } template <class E, size_t C> -const ZStrimW& operator<<(const ZStrimW& w, const ZMatrix<E,1,C>& mat) +const ZStrimW& operator<<(const ZStrimW& w, const ZMatrix<E,C,1>& mat) { w << "R["; for (size_t c = 0; c < C; ++c) { if (c) w << ", "; - w << mat.fE[0][c]; + w << mat.fE[c][0]; } w << "]"; return w; } -template <class E, size_t R, size_t C> -const ZStrimW& operator<<(const ZStrimW& w, const ZMatrix<E,R,C>& mat) +template <class E, size_t C, size_t R> +const ZStrimW& operator<<(const ZStrimW& w, const ZMatrix<E,C,R>& mat) { w << "["; for (size_t r = 0; r < R; ++r) @@ -66,7 +66,7 @@ { if (c) w << ", "; - w << mat.fE[r][c]; + w << mat.fE[c][r]; } w << "]"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-31 03:12:02
|
Revision: 2601 http://zoolib.svn.sourceforge.net/zoolib/?rev=2601&view=rev Author: agreen Date: 2011-10-31 03:11:56 +0000 (Mon, 31 Oct 2011) Log Message: ----------- Use locale-specific dialog templates when they're available. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZWinWND.cpp Modified: trunk/zoolib/source/cxx/zoolib/ZWinWND.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZWinWND.cpp 2011-10-30 23:05:36 UTC (rev 2600) +++ trunk/zoolib/source/cxx/zoolib/ZWinWND.cpp 2011-10-31 03:11:56 UTC (rev 2601) @@ -251,8 +251,23 @@ HWND sCreateDialog(LPCWSTR lpTemplate, HWND hWndParent, ZRef<Callable_Dialog> iCallable) { + HMODULE theHMODULE = ZUtil_Win::sGetModuleHandle(); + + LCID theLCID = ::GetThreadLocale(); + + if (HRSRC theHRSRC = ::FindResourceExW(theHMODULE, (LPCWSTR)RT_DIALOG, lpTemplate, theLCID)) + { + HGLOBAL theHGLOBAL = ::LoadResource(theHMODULE, theHRSRC); + return ::CreateDialogIndirectParam + (theHMODULE, + (LPCDLGTEMPLATE)::LockResource(theHGLOBAL), + hWndParent, + spDialogProcW, + (LPARAM)iCallable.Get()); + } + return ::CreateDialogParamW - (ZUtil_Win::sGetModuleHandle(), + (theHMODULE, lpTemplate, hWndParent, spDialogProcW, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-30 23:05:42
|
Revision: 2600 http://zoolib.svn.sourceforge.net/zoolib/?rev=2600&view=rev Author: agreen Date: 2011-10-30 23:05:36 +0000 (Sun, 30 Oct 2011) Log Message: ----------- WhileUnchanged returns iCallable0 if iCallable1 is null. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCog.h Modified: trunk/zoolib/source/cxx/zoolib/ZCog.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-10-30 02:56:11 UTC (rev 2599) +++ trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-10-30 23:05:36 UTC (rev 2600) @@ -641,8 +641,12 @@ (const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable0, const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable1) { - if (iCallable0 && iCallable1) - return spCog_WhileUnchanged(iCallable0, iCallable1); + if (iCallable0) + { + if (iCallable1) + return spCog_WhileUnchanged(iCallable0, iCallable1); + return iCallable0; + } return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-30 02:56:17
|
Revision: 2599 http://zoolib.svn.sourceforge.net/zoolib/?rev=2599&view=rev Author: agreen Date: 2011-10-30 02:56:11 +0000 (Sun, 30 Oct 2011) Log Message: ----------- Comment. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCog.h Modified: trunk/zoolib/source/cxx/zoolib/ZCog.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-10-30 02:55:40 UTC (rev 2598) +++ trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-10-30 02:56:11 UTC (rev 2599) @@ -99,6 +99,8 @@ #pragma mark - #pragma mark * sCog function and pseudo operator +#if 0 + const struct { template <class Param> @@ -133,6 +135,8 @@ } sCog = {}; +#endif + // ================================================================================================= #pragma mark - #pragma mark * sCog_Term @@ -616,7 +620,7 @@ #pragma mark - #pragma mark * sCog_WhileUnchanged -// Call second cog so long as the calling the first cog is unchanged. +// Call cog1 so long as cog0 is unchanged. template <class Param> ZCog<Param> spCogFun_WhileUnchanged(const ZCog<Param>& iSelf, Param iParam, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-30 02:55:47
|
Revision: 2598 http://zoolib.svn.sourceforge.net/zoolib/?rev=2598&view=rev Author: agreen Date: 2011-10-30 02:55:40 +0000 (Sun, 30 Oct 2011) Log Message: ----------- Add operator- Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZMatrix.h Modified: trunk/zoolib/source/cxx/zoolib/ZMatrix.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZMatrix.h 2011-10-29 15:19:22 UTC (rev 2597) +++ trunk/zoolib/source/cxx/zoolib/ZMatrix.h 2011-10-30 02:55:40 UTC (rev 2598) @@ -559,6 +559,22 @@ // ================================================================================================= #pragma mark - +#pragma mark * Negate + +template <class E, size_t R, size_t C> +ZMatrix<E,R,C> operator-(const ZMatrix<E,R,C>& iMat) + { + ZMatrix<E,R,C> result(null); + for (size_t c = 0; c < C; ++c) + { + for (size_t r = 0; r < R; ++r) + result.fE[c][r] = -iMat.fE[c][r]; + } + return result; + } + +// ================================================================================================= +#pragma mark - #pragma mark * Scalar multiplication template <class E, size_t R, size_t C, class T> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-29 15:19:28
|
Revision: 2597 http://zoolib.svn.sourceforge.net/zoolib/?rev=2597&view=rev Author: agreen Date: 2011-10-29 15:19:22 +0000 (Sat, 29 Oct 2011) Log Message: ----------- Move ZTime-dependent cogs into ZCog_Std. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCog.h Added Paths: ----------- trunk/zoolib/source/cxx/zoolib/ZCog_Std.h Modified: trunk/zoolib/source/cxx/zoolib/ZCog.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-10-29 15:18:38 UTC (rev 2596) +++ trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-10-29 15:19:22 UTC (rev 2597) @@ -691,7 +691,7 @@ #pragma mark * sCog_While template <class Param> -ZCog<Param> sCog_While(const ZCog<Param>& iCog_Init, const ZCog<Param>& iCog); +ZCog<Param> spCog_While(const ZCog<Param>& iCog_Init, const ZCog<Param>& iCog); template <class Param> ZCog<Param> spCogFun_While(const ZCog<Param>& iSelf, Param iParam, @@ -709,14 +709,20 @@ if (not newCog) return null; - if (sIsTerm(newCog)) - return sCallCog(sCog_While(iCog_Init, iCog_Init), iParam); //## Dangerous + if (not sIsTerm(newCog)) + return spCog_While(iCog_Init, newCog); + + // To get unbroken repetition on hitting a term we need to call the new cog. + // Only do so if this was not the first time, otherwise we're likely to + // recurse indefinitely and blow the stack. + if (iCog_Init == iCog) + return spCog_While(iCog_Init, iCog_Init); else - return sCog_While(iCog_Init, newCog); + return sCallCog(spCog_While(iCog_Init, iCog_Init), iParam); } template <class Param> -ZCog<Param> sCog_While(const ZCog<Param>& iCog_Init, const ZCog<Param>& iCog) +ZCog<Param> spCog_While(const ZCog<Param>& iCog_Init, const ZCog<Param>& iCog) { static ZMACRO_auto(spCallable, sCallable(spCogFun_While<Param>)); return sBindR(spCallable, iCog_Init, iCog); @@ -729,7 +735,7 @@ { if (sIsTerm(iCallable)) return iCallable; - return sCog_While<Param>(iCallable, iCallable); + return spCog_While<Param>(iCallable, iCallable); } return null; } @@ -779,66 +785,6 @@ const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable) { return spCog_Repeat<Param>(iCount, iCallable, iCallable); } -// ================================================================================================= -#pragma mark - -#pragma mark * sCog_DelayUntil - -template <class Param> -ZCog<Param> spCogFun_DelayUntil(const ZCog<Param>& iSelf, Param iParam, - ZTime iSystemTime) - { - if (ZTime::sSystem() > iSystemTime) - return sCog_Term<Param>(); - return iSelf; - } - -template <class Param> -ZCog<Param> sCog_DelayUntil(ZTime iSystemTime) - { - static ZMACRO_auto(spCallable, sCallable(spCogFun_DelayUntil<Param>)); - return sBindR(spCallable, iSystemTime); - } - -// ================================================================================================= -#pragma mark - -#pragma mark * sCog_DelayFor - -template <class Param> -ZCog<Param> spCogFun_DelayFor(const ZCog<Param>& iSelf, Param iParam, - double iDelay) - { return sCallCog(sCog_DelayUntil<Param>(ZTime::sSystem() + iDelay), iParam); } - -template <class Param> -ZCog<Param> sCog_DelayFor(double iDelay) - { - static ZMACRO_auto(spCallable, sCallable(spCogFun_DelayFor<Param>)); - return sBindR(spCallable, iDelay); - } - -// ================================================================================================= -#pragma mark - -#pragma mark * sCog_StartAt, sCog_StopAt, sCog_StartAfter, sCog_StopAfter - -template <class Param> -ZCog<Param> sCog_StartAt(ZTime iSystemTime, - const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable) - { return sCog_DelayUntil<Param>(iSystemTime) | iCallable; } - -template <class Param> -ZCog<Param> sCog_StopAt(ZTime iSystemTime, - const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable) - { return sCog_DelayUntil<Param>(iSystemTime) * iCallable; } - -template <class Param> -ZCog<Param> sCog_StartAfter(double iDelay, - const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >iCallable) - { return sCog_DelayFor<Param>(iDelay) | iCallable; } - -template <class Param> -ZCog<Param> sCog_StopAfter(double iDelay, - const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >iCallable) - { return sCog_DelayFor<Param>(iDelay) * iCallable; } - } // namespace ZooLib #endif // __ZCog__ Added: trunk/zoolib/source/cxx/zoolib/ZCog_Std.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCog_Std.h (rev 0) +++ trunk/zoolib/source/cxx/zoolib/ZCog_Std.h 2011-10-29 15:19:22 UTC (rev 2597) @@ -0,0 +1,91 @@ +/* ------------------------------------------------------------------------------------------------- +Copyright (c) 2011 Andrew Green +http://www.zoolib.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING +BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------------------------- */ + +#ifndef __ZCog_Std__ +#define __ZCog_Std__ 1 + +#include "zoolib/ZCog.h" +#include "zoolib/ZTime.h" + +namespace ZooLib { + +// ================================================================================================= +#pragma mark - +#pragma mark * sCog_DelayUntil + +template <class Param> +ZCog<Param> spCogFun_DelayUntil(const ZCog<Param>& iSelf, Param iParam, + ZTime iSystemTime) + { + if (ZTime::sSystem() > iSystemTime) + return sCog_Term<Param>(); + return iSelf; + } + +template <class Param> +ZCog<Param> sCog_DelayUntil(ZTime iSystemTime) + { + static ZMACRO_auto(spCallable, sCallable(spCogFun_DelayUntil<Param>)); + return sBindR(spCallable, iSystemTime); + } + +// ================================================================================================= +#pragma mark - +#pragma mark * sCog_DelayFor + +template <class Param> +ZCog<Param> spCogFun_DelayFor(const ZCog<Param>& iSelf, Param iParam, + double iDelay) + { return sCallCog(sCog_DelayUntil<Param>(ZTime::sSystem() + iDelay), iParam); } + +template <class Param> +ZCog<Param> sCog_DelayFor(double iDelay) + { + static ZMACRO_auto(spCallable, sCallable(spCogFun_DelayFor<Param>)); + return sBindR(spCallable, iDelay); + } + +// ================================================================================================= +#pragma mark - +#pragma mark * sCog_StartAt, sCog_StopAt, sCog_StartAfter, sCog_StopAfter + +template <class Param> +ZCog<Param> sCog_StartAt(ZTime iSystemTime, + const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable) + { return sCog_DelayUntil<Param>(iSystemTime) | iCallable; } + +template <class Param> +ZCog<Param> sCog_StopAt(ZTime iSystemTime, + const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >& iCallable) + { return sCog_DelayUntil<Param>(iSystemTime) * iCallable; } + +template <class Param> +ZCog<Param> sCog_StartAfter(double iDelay, + const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >iCallable) + { return sCog_DelayFor<Param>(iDelay) | iCallable; } + +template <class Param> +ZCog<Param> sCog_StopAfter(double iDelay, + const ZRef<ZCallable<ZCog<Param>(const ZCog<Param>&,Param)> >iCallable) + { return sCog_DelayFor<Param>(iDelay) * iCallable; } + +} // namespace ZooLib + +#endif // __ZCog_Std__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-29 15:18:45
|
Revision: 2596 http://zoolib.svn.sourceforge.net/zoolib/?rev=2596&view=rev Author: agreen Date: 2011-10-29 15:18:38 +0000 (Sat, 29 Oct 2011) Log Message: ----------- sp. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZTime.cpp Modified: trunk/zoolib/source/cxx/zoolib/ZTime.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZTime.cpp 2011-10-28 18:09:26 UTC (rev 2595) +++ trunk/zoolib/source/cxx/zoolib/ZTime.cpp 2011-10-29 15:18:38 UTC (rev 2596) @@ -58,7 +58,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZTime constatnts +#pragma mark * ZTime constants const double ZTime::kSecond = 1; const double ZTime::kMinute = 60 * kSecond; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-28 18:09:32
|
Revision: 2595 http://zoolib.svn.sourceforge.net/zoolib/?rev=2595&view=rev Author: agreen Date: 2011-10-28 18:09:26 +0000 (Fri, 28 Oct 2011) Log Message: ----------- Add missing IsEmpty implementation. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2011-10-28 18:09:11 UTC (rev 2594) +++ trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2011-10-28 18:09:26 UTC (rev 2595) @@ -425,6 +425,9 @@ } } +bool ZMap_Any::IsEmpty() const + { return not fRep || fRep->fMap.empty(); } + void ZMap_Any::Clear() { fRep.Clear(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-28 18:09:17
|
Revision: 2594 http://zoolib.svn.sourceforge.net/zoolib/?rev=2594&view=rev Author: agreen Date: 2011-10-28 18:09:11 +0000 (Fri, 28 Oct 2011) Log Message: ----------- Oops. IsNull test was wrong way around. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZAny.cpp Modified: trunk/zoolib/source/cxx/zoolib/ZAny.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZAny.cpp 2011-10-28 14:45:05 UTC (rev 2593) +++ trunk/zoolib/source/cxx/zoolib/ZAny.cpp 2011-10-28 18:09:11 UTC (rev 2594) @@ -119,7 +119,7 @@ } bool ZAny::IsNull() const - { return fPtr_InPlace || fHolder_Ref(); } + { return not fPtr_InPlace && not fHolder_Ref(); } void ZAny::Clear() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-28 14:45:12
|
Revision: 2593 http://zoolib.svn.sourceforge.net/zoolib/?rev=2593&view=rev Author: agreen Date: 2011-10-28 14:45:05 +0000 (Fri, 28 Oct 2011) Log Message: ----------- Remove operator_bool stuff from Maps and Yads. Modified Paths: -------------- trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h trunk/zoolib/source/cxx/more/zoolib/zra/ZRA_AsSQL.cpp trunk/zoolib/source/cxx/old/zoolib/ZVal_ZooLib.cpp trunk/zoolib/source/cxx/zoolib/ZAny.cpp trunk/zoolib/source/cxx/zoolib/ZAny.h trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp trunk/zoolib/source/cxx/zoolib/ZData_Any.h trunk/zoolib/source/cxx/zoolib/ZData_CF.cpp trunk/zoolib/source/cxx/zoolib/ZData_CF.h trunk/zoolib/source/cxx/zoolib/ZData_NS.h trunk/zoolib/source/cxx/zoolib/ZData_NS.mm trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.cpp trunk/zoolib/source/cxx/zoolib/ZMatrix.h trunk/zoolib/source/cxx/zoolib/ZUtil_CF.cpp trunk/zoolib/source/cxx/zoolib/ZUtil_NS.mm trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp trunk/zoolib/source/cxx/zoolib/ZVal_Any.h trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h trunk/zoolib/source/cxx/zoolib/ZVal_NS.h trunk/zoolib/source/cxx/zoolib/ZVal_Yad.cpp trunk/zoolib/source/cxx/zoolib/ZVal_Yad.h trunk/zoolib/source/cxx/zoolib/ZWinCOM.cpp trunk/zoolib/source/cxx/zoolib/ZWinCOM.h trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp trunk/zoolib/source/cxx/zoolib/ZYad_XMLPList.cpp Modified: trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/more/zoolib/javascriptcore/ZJavaScriptCore.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -298,7 +298,7 @@ { if (false) {} - else if (not iAny) + else if (iAny.IsNull()) { return Value(); } Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -1114,9 +1114,6 @@ \brief Encapsulates a PIActionList, implementing the ZSeq API. */ -Seq::operator operator_bool() const - { return operator_bool_gen::translate(this->Count()); } - ZSeq_Any Seq::AsSeq_Any(const ZAny& iDefault) const { ZSeq_Any theSeq; @@ -1249,9 +1246,6 @@ \brief Encapsulates a PIActionDescriptor, implementing the ZMap API. */ -Map::operator operator_bool() const - { return operator_bool_gen::translate(this->pCount()); } - ZMap_Any Map::AsMap_Any(const ZAny& iDefault) const { ZMap_Any theMap; @@ -1319,6 +1313,9 @@ , fAD(iOther.Get()) {} +bool Map::IsEmpty() const + { return 0 == this->pCount(); } + void Map::Clear() { spPSActionDescriptor->Clear(fAD); } Modified: trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/more/zoolib/photoshop/ZPhotoshop_Val.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -277,8 +277,6 @@ public: typedef Val Val_t; - ZMACRO_operator_bool(Seq, operator_bool) const; - ZSeq_Any AsSeq_Any(const ZAny& iDefault) const; void swap(Seq& iOther); @@ -348,8 +346,6 @@ typedef ZTagVal<size_t,Map> Index_t; typedef Val Val_t; - ZMACRO_operator_bool(Map, operator_bool) const; - ZMap_Any AsMap_Any(const ZAny& iDefault) const; void swap(Map& iOther); @@ -369,6 +365,8 @@ Map(const string8& iType, Adopt_T<PIActionDescriptor> iOther); // ZMap protocol + bool IsEmpty() const; + void Clear(); ZQ<Val> QGet(KeyID iKey) const; Modified: trunk/zoolib/source/cxx/more/zoolib/zra/ZRA_AsSQL.cpp =================================================================== --- trunk/zoolib/source/cxx/more/zoolib/zra/ZRA_AsSQL.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/more/zoolib/zra/ZRA_AsSQL.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -325,7 +325,7 @@ { if (false) {} - else if (not iAny) + else if (iAny.IsNull()) { s << "null"; } Modified: trunk/zoolib/source/cxx/old/zoolib/ZVal_ZooLib.cpp =================================================================== --- trunk/zoolib/source/cxx/old/zoolib/ZVal_ZooLib.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/old/zoolib/ZVal_ZooLib.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -235,7 +235,7 @@ { if (false) {} - else if (not iAny) + else if (iAny.IsNull()) { oVal = ZVal_ZooLib(); } Modified: trunk/zoolib/source/cxx/zoolib/ZAny.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZAny.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZAny.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -41,9 +41,6 @@ inline const ZRef<ZAny::Holder_Counted>& ZAny::fHolder_Ref() const { return *sFetch_T<ZRef<Holder_Counted> >(fBytes_Payload); } -ZAny::operator operator_bool() const - { return operator_bool_gen::translate(fPtr_InPlace || fHolder_Ref()); } - const std::type_info& ZAny::Type() const { if (spIsPOD(fPtr_InPlace)) @@ -121,6 +118,9 @@ } } +bool ZAny::IsNull() const + { return fPtr_InPlace || fHolder_Ref(); } + void ZAny::Clear() { if (spIsPOD(fPtr_InPlace)) Modified: trunk/zoolib/source/cxx/zoolib/ZAny.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZAny.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZAny.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -60,8 +60,6 @@ template <class S> ZAny& operator=(const S& iVal); - ZMACRO_operator_bool(ZAny, operator_bool) const; - const std::type_info& Type() const; void* VoidStar(); @@ -70,6 +68,8 @@ // ZVal protocol, generally for use by ZVal derivatives void swap(ZAny& ioOther); + bool IsNull() const; + void Clear(); template <class S> Modified: trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZData_Any.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -65,9 +65,6 @@ ZAny ZData_Any::AsAny() const { return ZAny(*this); } -ZData_Any::operator operator_bool() const - { return operator_bool_gen::translate(fRep->fVector.size()); } - ZData_Any::ZData_Any() : fRep(new Rep) {} Modified: trunk/zoolib/source/cxx/zoolib/ZData_Any.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZData_Any.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -24,7 +24,6 @@ #include "zoolib/ZAny.h" #include "zoolib/ZCompare_T.h" -#include "zoolib/ZCompat_operator_bool.h" #include "zoolib/ZRef.h" namespace ZooLib { @@ -40,8 +39,6 @@ public: ZAny AsAny() const; - ZMACRO_operator_bool(ZData_Any, operator_bool) const; - ZData_Any(); ZData_Any(const ZData_Any& iOther); ~ZData_Any(); Modified: trunk/zoolib/source/cxx/zoolib/ZData_CF.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_CF.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZData_CF.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -38,9 +38,6 @@ ZAny ZData_CF::AsAny() const { return ZUtil_CF::sAsAny(this->pData()); } -ZData_CF::operator bool() const - { return this->GetSize(); } - ZData_CF::ZData_CF() : inherited(sDataMutable()) {} Modified: trunk/zoolib/source/cxx/zoolib/ZData_CF.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_CF.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZData_CF.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -43,8 +43,6 @@ public: ZAny AsAny() const; - operator bool() const; - ZData_CF(); ZData_CF(const ZData_CF& iOther); ~ZData_CF(); Modified: trunk/zoolib/source/cxx/zoolib/ZData_NS.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_NS.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZData_NS.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -45,8 +45,6 @@ public: ZAny AsAny() const; - operator bool() const; - ZData_NS(); ZData_NS(const ZData_NS& iOther); ~ZData_NS(); Modified: trunk/zoolib/source/cxx/zoolib/ZData_NS.mm =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZData_NS.mm 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZData_NS.mm 2011-10-28 14:45:05 UTC (rev 2593) @@ -34,9 +34,6 @@ ZAny ZData_NS::AsAny() const { return ZUtil_NS::sAsAny(this->pData()); } -ZData_NS::operator bool() const - { return this->GetSize(); } - ZData_NS::ZData_NS() : inherited(sDataMutable()) {} Modified: trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZHTTP.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -795,7 +795,7 @@ Map temp; temp.Set("type", type); temp.Set("subtype", subtype); - if (parameters) + if (not parameters.IsEmpty()) temp.Set("parameters", parameters); if (ioFields) spAppend(*ioFields, "accept", temp); @@ -838,7 +838,7 @@ parameters.Set(name, value); } - if (parameters) + if (not parameters.IsEmpty()) temp.Set("parameters", parameters); if (ioFields) @@ -998,7 +998,7 @@ sSkipLWS(iStream); - if (parameters) + if (not parameters.IsEmpty()) oTuple.Set("parameters", parameters); return true; } @@ -1095,7 +1095,7 @@ Map temp; temp.Set("type", type); temp.Set("subtype", subType); - if (parameters) + if (not parameters.IsEmpty()) temp.Set("parameters", parameters); ioFields->Set("content-type", temp); } Modified: trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZHTTP_Requests.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -441,7 +441,7 @@ // strimmer, which it does by examining values in iHeader. return spCreateStrimmerR(iHeader, iStreamR)->GetStrimR().ReadAll8(); } - else if (!content_type) + else if (content_type.IsEmpty()) { // There was no content type specified, so assume text. string theString; Modified: trunk/zoolib/source/cxx/zoolib/ZMatrix.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZMatrix.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZMatrix.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -461,7 +461,7 @@ { ZMatrix<E,RL,CR> result; for (size_t rl = 0; rl < RL; ++rl) - {//### + { for (size_t cr = 0; cr < CR; ++cr) { for (size_t o = 0; o < Common; ++o) @@ -477,6 +477,18 @@ // ================================================================================================= #pragma mark - +#pragma mark * Composition + +template <class E, size_t RL, size_t Common> +ZMatrix<E,Common,1> operator*(const ZMatrix<E,RL,Common+1>& iLeft, const ZMatrix<E,Common,1>& iRight) + { return sCartesian(iLeft * sHomogenous(iRight)); } + +template <class E, size_t RL, size_t Common> +ZMatrix<E,Common,1>& operator*=(ZMatrix<E,RL,Common+1>& ioLeft, const ZMatrix<E,Common,1>& iRight) + { return ioLeft = ioLeft * iRight; } + +// ================================================================================================= +#pragma mark - #pragma mark * Element-by-element multiplication template <class E, size_t R, size_t C> Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_CF.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_CF.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_CF.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -308,7 +308,7 @@ { if (false) {} - else if (not iVal) + else if (iVal.IsNull()) { #if defined(MAC_OS_X_VERSION_MIN_REQUIRED) \ && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_2 Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_NS.mm =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_NS.mm 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_NS.mm 2011-10-28 14:45:05 UTC (rev 2593) @@ -154,7 +154,7 @@ { if (false) {} - else if (not iVal) + else if (iVal.IsNull()) { return [NSNull null]; } Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZVal_Any.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -134,9 +134,6 @@ #pragma mark - #pragma mark * ZSeq_Any -ZSeq_Any::operator operator_bool() const - { return operator_bool_gen::translate(fRep && !fRep->fVector.empty()); } - ZSeq_Any::ZSeq_Any() {} @@ -306,9 +303,6 @@ static string8 spEmptyString; static ZMap_Any::Map_t spEmptyMap; -ZMap_Any::operator operator_bool() const - { return operator_bool_gen::translate(fRep && !fRep->fMap.empty()); } - ZMap_Any::ZMap_Any() {} Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Any.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Any.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZVal_Any.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -237,8 +237,6 @@ typedef std::vector<ZVal_Any> Vector_t; typedef ZVal_Any Val_t; - ZMACRO_operator_bool(ZSeq_Any, operator_bool) const; - ZSeq_Any(); ZSeq_Any(const ZSeq_Any& iOther); ~ZSeq_Any(); @@ -373,8 +371,6 @@ typedef Map_t::iterator Index_t; typedef ZVal_Any Val_t; - ZMACRO_operator_bool(ZMap_Any, operator_bool) const; - ZMap_Any(); ZMap_Any(const ZMap_Any& iOther); ~ZMap_Any(); @@ -393,6 +389,8 @@ int Compare(const ZMap_Any& iOther) const; // ZMap protocol + bool IsEmpty() const; + void Clear(); ZVal_Any* PGetMutable(const string8& iName); Modified: trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -484,9 +484,6 @@ ZSeq_Any ZSeq_AppleEvent::AsSeq_Any(const ZAny& iDefault) const { return spAsSeq_Any(iDefault, *this); } -ZSeq_AppleEvent::operator operator_bool() const - { return operator_bool_gen::translate(this->Count()); } - void ZSeq_AppleEvent::swap(ZSeq_AppleEvent& iOther) { std::swap(static_cast<AEDesc&>(*this), static_cast<AEDesc&>(iOther)); } @@ -616,9 +613,6 @@ ZMap_Any ZMap_AppleEvent::AsMap_Any(const ZAny& iDefault) const { return spAsMap_Any(iDefault, *this); } -ZMap_AppleEvent::operator operator_bool() const - { return operator_bool_gen::translate(this->pCount()); } - void ZMap_AppleEvent::swap(ZMap_AppleEvent& iOther) { std::swap(static_cast<AEDesc&>(*this), static_cast<AEDesc&>(iOther)); } Modified: trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZVal_AppleEvent.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -152,8 +152,6 @@ ZSeq_Any AsSeq_Any(const ZAny& iDefault) const; - ZMACRO_operator_bool(ZSeq_AppleEvent, operator_bool) const; - void swap(ZSeq_AppleEvent& iOther); ZSeq_AppleEvent(); @@ -199,8 +197,6 @@ ZMap_Any AsMap_Any(const ZAny& iDefault) const; - ZMACRO_operator_bool(ZMap_AppleEvent, operator_bool) const; - void swap(ZMap_AppleEvent& iOther); ZMap_AppleEvent(); Modified: trunk/zoolib/source/cxx/zoolib/ZVal_NS.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_NS.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZVal_NS.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -25,7 +25,6 @@ #if ZCONFIG_SPI_Enabled(Cocoa) -#include "zoolib/ZCompat_operator_bool.h" #include "zoolib/ZData_NS.h" #include "zoolib/ZRef_NS.h" #include "zoolib/ZUnicodeString.h" Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Yad.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Yad.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZVal_Yad.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -30,8 +30,8 @@ ZAny ZVal_Yad::AsAny() const { return this->pAsAny(); } -ZVal_Yad::operator operator_bool() const - { return operator_bool_gen::translate(fYad); } +//##ZVal_Yad::operator operator_bool() const +//## { return operator_bool_gen::translate(fYad); } ZVal_Yad::ZVal_Yad() {} @@ -79,6 +79,9 @@ return *this; } +bool ZVal_Yad::IsNull() const + { return fYad; } + ZVal_Yad ZVal_Yad::Get(const string8& iName) const { if (ZRef<ZYadMapRPos> theYad = fYad.DynamicCast<ZYadMapRPos>()) Modified: trunk/zoolib/source/cxx/zoolib/ZVal_Yad.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZVal_Yad.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZVal_Yad.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -42,7 +42,7 @@ { public: ZAny AsAny() const; - ZMACRO_operator_bool(ZVal_Yad, operator_bool) const; + //##ZMACRO_operator_bool(ZVal_Yad, operator_bool) const; ZVal_Yad(); ZVal_Yad(const ZVal_Yad& iOther); @@ -59,6 +59,8 @@ ZVal_Yad& operator=(const ZMap_Yad& iMap); // ZVal protocol + bool IsNull() const; + template <class S> ZQ<S> QGet() const; Modified: trunk/zoolib/source/cxx/zoolib/ZWinCOM.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZWinCOM.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZWinCOM.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -183,6 +183,9 @@ sRefCopy(&pdispVal, iVal); } +bool Variant::IsNull() const + { return VT_NULL == vt; } + template <> ZQ<int8> Variant::QGet<int8>() const { Modified: trunk/zoolib/source/cxx/zoolib/ZWinCOM.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZWinCOM.h 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZWinCOM.h 2011-10-28 14:45:05 UTC (rev 2593) @@ -294,6 +294,8 @@ Variant(IDispatch* iVal); // ZVal protocol + bool IsNull() const; + template <class S> ZQ<S> QGet() const; Modified: trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZYad_JSON.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -449,7 +449,7 @@ { if (false) {} - else if (not iAny) + else if (iAny.IsNull()) { s << "null"; } Modified: trunk/zoolib/source/cxx/zoolib/ZYad_XMLPList.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZYad_XMLPList.cpp 2011-10-25 19:14:49 UTC (rev 2592) +++ trunk/zoolib/source/cxx/zoolib/ZYad_XMLPList.cpp 2011-10-28 14:45:05 UTC (rev 2593) @@ -372,7 +372,7 @@ if (false) {} - else if (not iVal) + else if (iVal.IsNull()) { s.Empty("nil"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-25 19:14:55
|
Revision: 2592 http://zoolib.svn.sourceforge.net/zoolib/?rev=2592&view=rev Author: agreen Date: 2011-10-25 19:14:49 +0000 (Tue, 25 Oct 2011) Log Message: ----------- Slight change in implementation, so we don't enqueue a callable if pTrigger fails. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCaller_EventLoop.cpp Modified: trunk/zoolib/source/cxx/zoolib/ZCaller_EventLoop.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCaller_EventLoop.cpp 2011-10-25 17:17:14 UTC (rev 2591) +++ trunk/zoolib/source/cxx/zoolib/ZCaller_EventLoop.cpp 2011-10-25 19:14:49 UTC (rev 2592) @@ -40,8 +40,9 @@ if (iCallable) { ZAcqMtx acq(fMtx); - if (fTriggered++ || this->pTrigger()) + if (fTriggered || this->pTrigger()) { + fTriggered = true; fCallables.push_back(iCallable); return true; } @@ -68,6 +69,7 @@ { ZAcqMtx acq(fMtx); fCallables.clear(); + fTriggered = false; } } // namespace ZooLib This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-25 17:17:20
|
Revision: 2591 http://zoolib.svn.sourceforge.net/zoolib/?rev=2591&view=rev Author: agreen Date: 2011-10-25 17:17:14 +0000 (Tue, 25 Oct 2011) Log Message: ----------- Comment. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZQ.h Modified: trunk/zoolib/source/cxx/zoolib/ZQ.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZQ.h 2011-10-25 17:16:58 UTC (rev 2590) +++ trunk/zoolib/source/cxx/zoolib/ZQ.h 2011-10-25 17:17:14 UTC (rev 2591) @@ -33,6 +33,7 @@ #pragma mark - #pragma mark * ZQ +// The 'Q' stands for 'Questionable' or 'Queryable' // c.f. Haskell's Data.Maybe, Scala's Option. template <class T, bool Sense = true> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-25 17:17:04
|
Revision: 2590 http://zoolib.svn.sourceforge.net/zoolib/?rev=2590&view=rev Author: agreen Date: 2011-10-25 17:16:58 +0000 (Tue, 25 Oct 2011) Log Message: ----------- Comments and neat-freak. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCallable_Compound.h trunk/zoolib/source/cxx/zoolib/ZCallable_Set.h Modified: trunk/zoolib/source/cxx/zoolib/ZCallable_Compound.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCallable_Compound.h 2011-10-24 15:17:31 UTC (rev 2589) +++ trunk/zoolib/source/cxx/zoolib/ZCallable_Compound.h 2011-10-25 17:16:58 UTC (rev 2590) @@ -28,7 +28,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZCallable_Apply +#pragma mark * sCallable_Apply template <class A, class B, class C> class ZCallable_Apply @@ -53,10 +53,6 @@ const ZRef<ZCallable<B(C)> > fCallable; }; -// ================================================================================================= -#pragma mark - -#pragma mark * sCallable_Apply - template <class A, class B, class C> ZRef<ZCallable<A(C)> > sCallable_Apply(const ZRef<ZCallable<A(B)> >& iApply, const ZRef<ZCallable<B(C)> >& iCallable) @@ -64,7 +60,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZCallable_Seq +#pragma mark * sCallable_Seq template <class R0, class R1> class ZCallable_Seq @@ -95,7 +91,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZCallable_For +#pragma mark * sCallable_For template <class R_Init, class R_Inc> class ZCallable_For @@ -132,7 +128,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * ZCallable_If +#pragma mark * sCallable_If template <class R> class ZCallable_If @@ -172,7 +168,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * Makers +#pragma mark * sCallable_Repeat template<class R> class ZCallable_Repeat @@ -207,7 +203,7 @@ // ================================================================================================= #pragma mark - -#pragma mark * Makers +#pragma mark * sCallable_While template <class R> class ZCallable_While Modified: trunk/zoolib/source/cxx/zoolib/ZCallable_Set.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCallable_Set.h 2011-10-24 15:17:31 UTC (rev 2589) +++ trunk/zoolib/source/cxx/zoolib/ZCallable_Set.h 2011-10-25 17:16:58 UTC (rev 2590) @@ -44,24 +44,25 @@ public: typedef ZCallable<void(void)> Callable; - void Insert(ZRef<Callable> iCallable) - { fCallables.Insert(iCallable); } - - void Erase(ZRef<Callable> iCallable) - { fCallables.Erase(iCallable); } - +// From ZCallable ZQ<void> QCall() { for (ZSafeSetIterConst<ZRef<Callable> > iter = fCallables; /*no test*/; /*no inc*/) { - if (ZQ<ZRef<Callable>,false> theQ = iter.QReadInc()) - break; + if (ZQ<ZRef<Callable> > theQ = iter.QReadInc()) + sCall(theQ.Get()); else - sCall(theQ.Get()); + return notnull; } - return notnull; } +// Our protocol + void Insert(ZRef<Callable> iCallable) + { fCallables.Insert(iCallable); } + + void Erase(ZRef<Callable> iCallable) + { fCallables.Erase(iCallable); } + private: ZSafeSet<ZRef<Callable> > fCallables; }; @@ -77,24 +78,25 @@ public: typedef ZCallable<void(P0)> Callable; - void Insert(ZRef<Callable> iCallable) - { fCallables.Insert(iCallable); } - - void Erase(ZRef<Callable> iCallable) - { fCallables.Erase(iCallable); } - +// From ZCallable ZQ<void> QCall(P0 i0) { for (ZSafeSetIterConst<ZRef<Callable> > iter = fCallables; /*no test*/; /*no inc*/) { - if (ZQ<ZRef<Callable>,false> theQ = iter.QReadInc()) - break; + if (ZQ<ZRef<Callable> > theQ = iter.QReadInc()) + sCall(theQ.Get(), i0); else - sCall(theQ.Get(), i0); + return notnull; } - return notnull; } +// Our protocol + void Insert(ZRef<Callable> iCallable) + { fCallables.Insert(iCallable); } + + void Erase(ZRef<Callable> iCallable) + { fCallables.Erase(iCallable); } + private: ZSafeSet<ZRef<Callable> > fCallables; }; @@ -110,24 +112,25 @@ public: typedef ZCallable<void(P0,P1)> Callable; - void Insert(ZRef<Callable> iCallable) - { fCallables.Insert(iCallable); } - - void Erase(ZRef<Callable> iCallable) - { fCallables.Erase(iCallable); } - +// From ZCallable ZQ<void> QCall(P0 i0, P1 i1) { for (ZSafeSetIterConst<ZRef<Callable> > iter = fCallables; /*no test*/; /*no inc*/) { - if (ZQ<ZRef<Callable>,false> theQ = iter.QReadInc()) - break; + if (ZQ<ZRef<Callable> > theQ = iter.QReadInc()) + sCall(theQ.Get(), i0, i1); else - sCall(theQ.Get(), i0, i1); + return notnull; } - return notnull; } +// Our protocol + void Insert(ZRef<Callable> iCallable) + { fCallables.Insert(iCallable); } + + void Erase(ZRef<Callable> iCallable) + { fCallables.Erase(iCallable); } + private: ZSafeSet<ZRef<Callable> > fCallables; }; @@ -143,24 +146,25 @@ public: typedef ZCallable<void(P0,P1,P2)> Callable; - void Insert(ZRef<Callable> iCallable) - { fCallables.Insert(iCallable); } - - void Erase(ZRef<Callable> iCallable) - { fCallables.Erase(iCallable); } - +// From ZCallable ZQ<void> QCall(P0 i0, P1 i1, P2 i2) { for (ZSafeSetIterConst<ZRef<Callable> > iter = fCallables; /*no test*/; /*no inc*/) { - if (ZQ<ZRef<Callable>,false> theQ = iter.QReadInc()) - break; + if (ZQ<ZRef<Callable> > theQ = iter.QReadInc()) + sCall(theQ.Get(), i0, i1, i2); else - sCall(theQ.Get(), i0, i1, i2); + return notnull; } - return notnull; } +// Our protocol + void Insert(ZRef<Callable> iCallable) + { fCallables.Insert(iCallable); } + + void Erase(ZRef<Callable> iCallable) + { fCallables.Erase(iCallable); } + private: ZSafeSet<ZRef<Callable> > fCallables; }; @@ -176,24 +180,25 @@ public: typedef ZCallable<void(P0,P1,P2,P3)> Callable; - void Insert(ZRef<Callable> iCallable) - { fCallables.Insert(iCallable); } - - void Erase(ZRef<Callable> iCallable) - { fCallables.Erase(iCallable); } - +// From ZCallable ZQ<void> QCall(P0 i0, P1 i1, P2 i2, P3 i3) { for (ZSafeSetIterConst<ZRef<Callable> > iter = fCallables; /*no test*/; /*no inc*/) { - if (ZQ<ZRef<Callable>,false> theQ = iter.QReadInc()) - break; + if (ZQ<ZRef<Callable> > theQ = iter.QReadInc()) + sCall(theQ.Get(), i0, i1, i2, i3); else - sCall(theQ.Get(), i0, i1, i2, i3); + return notnull; } - return notnull; } +// Our protocol + void Insert(ZRef<Callable> iCallable) + { fCallables.Insert(iCallable); } + + void Erase(ZRef<Callable> iCallable) + { fCallables.Erase(iCallable); } + private: ZSafeSet<ZRef<Callable> > fCallables; }; @@ -209,24 +214,25 @@ public: typedef ZCallable<void(P0,P1,P2,P3,P4)> Callable; - void Insert(ZRef<Callable> iCallable) - { fCallables.Insert(iCallable); } - - void Erase(ZRef<Callable> iCallable) - { fCallables.Erase(iCallable); } - +// From ZCallable ZQ<void> QCall(P0 i0, P1 i1, P2 i2, P3 i3, P4 i4) { for (ZSafeSetIterConst<ZRef<Callable> > iter = fCallables; /*no test*/; /*no inc*/) { - if (ZQ<ZRef<Callable>,false> theQ = iter.QReadInc()) - break; + if (ZQ<ZRef<Callable> > theQ = iter.QReadInc()) + sCall(theQ.Get(), i0, i1, i2, i3, i4); else - sCall(theQ.Get(), i0, i1, i2, i3, i4); + return notnull; } - return notnull; } +// Our protocol + void Insert(ZRef<Callable> iCallable) + { fCallables.Insert(iCallable); } + + void Erase(ZRef<Callable> iCallable) + { fCallables.Erase(iCallable); } + private: ZSafeSet<ZRef<Callable> > fCallables; }; @@ -242,24 +248,25 @@ public: typedef ZCallable<void(P0,P1,P2,P3,P4,P5)> Callable; - void Insert(ZRef<Callable> iCallable) - { fCallables.Insert(iCallable); } - - void Erase(ZRef<Callable> iCallable) - { fCallables.Erase(iCallable); } - +// From ZCallable ZQ<void> QCall(P0 i0, P1 i1, P2 i2, P3 i3, P4 i4, P5 i5) { for (ZSafeSetIterConst<ZRef<Callable> > iter = fCallables; /*no test*/; /*no inc*/) { - if (ZQ<ZRef<Callable>,false> theQ = iter.QReadInc()) - break; + if (ZQ<ZRef<Callable> > theQ = iter.QReadInc()) + sCall(theQ.Get(), i0, i1, i2, i3, i4, i5); else - sCall(theQ.Get(), i0, i1, i2, i3, i4, i5); + return notnull; } - return notnull; } +// Our protocol + void Insert(ZRef<Callable> iCallable) + { fCallables.Insert(iCallable); } + + void Erase(ZRef<Callable> iCallable) + { fCallables.Erase(iCallable); } + private: ZSafeSet<ZRef<Callable> > fCallables; }; @@ -275,22 +282,16 @@ public: typedef ZCallable<void(P0,P1,P2,P3,P4,P5,P6)> Callable; - void Insert(ZRef<Callable> iCallable) - { fCallables.Insert(iCallable); } - - void Erase(ZRef<Callable> iCallable) - { fCallables.Erase(iCallable); } - +// From ZCallable ZQ<void> QCall(P0 i0, P1 i1, P2 i2, P3 i3, P4 i4, P5 i5, P6 i6) { for (ZSafeSetIterConst<ZRef<Callable> > iter = fCallables; /*no test*/; /*no inc*/) { - if (ZQ<ZRef<Callable>,false> theQ = iter.QReadInc()) - break; + if (ZQ<ZRef<Callable> > theQ = iter.QReadInc()) + sCall(theQ.Get(), i0, i1, i2, i3, i4, i5, i6); else - sCall(theQ.Get(), i0, i1, i2, i3, i4, i5, i6); + return notnull; } - return notnull; } private: @@ -308,24 +309,25 @@ public: typedef ZCallable<void(P0,P1,P2,P3,P4,P5,P6,P7)> Callable; - void Insert(ZRef<Callable> iCallable) - { fCallables.Insert(iCallable); } - - void Erase(ZRef<Callable> iCallable) - { fCallables.Erase(iCallable); } - +// From ZCallable ZQ<void> QCall(P0 i0, P1 i1, P2 i2, P3 i3, P4 i4, P5 i5, P6 i6, P7 i7) { for (ZSafeSetIterConst<ZRef<Callable> > iter = fCallables; /*no test*/; /*no inc*/) { - if (ZQ<ZRef<Callable>,false> theQ = iter.QReadInc()) - break; + if (ZQ<ZRef<Callable> > theQ = iter.QReadInc()) + sCall(theQ.Get(), i0, i1, i2, i3, i4, i5, i6, i7); else - sCall(theQ.Get(), i0, i1, i2, i3, i4, i5, i6, i7); + return notnull; } - return notnull; } +// Our protocol + void Insert(ZRef<Callable> iCallable) + { fCallables.Insert(iCallable); } + + void Erase(ZRef<Callable> iCallable) + { fCallables.Erase(iCallable); } + private: ZSafeSet<ZRef<Callable> > fCallables; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-24 15:17:40
|
Revision: 2589 http://zoolib.svn.sourceforge.net/zoolib/?rev=2589&view=rev Author: agreen Date: 2011-10-24 15:17:31 +0000 (Mon, 24 Oct 2011) Log Message: ----------- Some tweaks. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCallByCaller.h trunk/zoolib/source/cxx/zoolib/ZCallScheduler.cpp trunk/zoolib/source/cxx/zoolib/ZCaller_CFRunLoop.cpp trunk/zoolib/source/cxx/zoolib/ZCaller_WinMessageLoop.cpp trunk/zoolib/source/cxx/zoolib/ZPromise.h trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.cpp Modified: trunk/zoolib/source/cxx/zoolib/ZCallByCaller.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCallByCaller.h 2011-10-24 14:46:25 UTC (rev 2588) +++ trunk/zoolib/source/cxx/zoolib/ZCallByCaller.h 2011-10-24 15:17:31 UTC (rev 2589) @@ -23,7 +23,6 @@ #include "zconfig.h" #include "zoolib/ZCaller.h" -#include "zoolib/ZCallable.h" #include "zoolib/ZCallable_Bind.h" #include "zoolib/ZCallable_Function.h" #include "zoolib/ZPromise.h" Modified: trunk/zoolib/source/cxx/zoolib/ZCallScheduler.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCallScheduler.cpp 2011-10-24 14:46:25 UTC (rev 2588) +++ trunk/zoolib/source/cxx/zoolib/ZCallScheduler.cpp 2011-10-24 15:17:31 UTC (rev 2589) @@ -121,19 +121,19 @@ } else { - set<TimeJob>::iterator front = fTimeJobs.begin(); - const double delta = front->first - ZTime::sSystem(); + set<TimeJob>::iterator begin = fTimeJobs.begin(); + const double delta = begin->first - ZTime::sSystem(); if (delta > 0) { fCnd.WaitFor(fMtxR, delta); } else { - ZRef<ZCaller> theCaller = front->second.first; - ZRef<ZCallable_Void> theCallable = front->second.second; + ZRef<ZCaller> theCaller = begin->second.first; + ZRef<ZCallable_Void> theCallable = begin->second.second; - ZUtil_STL::sEraseMustContain(fJobTimes, make_pair(front->second, front->first)); - fTimeJobs.erase(front); + ZUtil_STL::sEraseMustContain(fJobTimes, make_pair(begin->second, begin->first)); + fTimeJobs.erase(begin); guard.Release(); Modified: trunk/zoolib/source/cxx/zoolib/ZCaller_CFRunLoop.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCaller_CFRunLoop.cpp 2011-10-24 14:46:25 UTC (rev 2588) +++ trunk/zoolib/source/cxx/zoolib/ZCaller_CFRunLoop.cpp 2011-10-24 15:17:31 UTC (rev 2589) @@ -35,10 +35,9 @@ static CFRunLoopRef spRunLoopMain = ::CFRunLoopGetCurrent(); #endif -static ZRef<ZCaller_CFRunLoop> spCaller; - ZRef<ZCaller_CFRunLoop> ZCaller_CFRunLoop::sMain() { + static ZRef<ZCaller_CFRunLoop> spCaller; if (!spCaller) { #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 Modified: trunk/zoolib/source/cxx/zoolib/ZCaller_WinMessageLoop.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCaller_WinMessageLoop.cpp 2011-10-24 14:46:25 UTC (rev 2588) +++ trunk/zoolib/source/cxx/zoolib/ZCaller_WinMessageLoop.cpp 2011-10-24 15:17:31 UTC (rev 2589) @@ -52,7 +52,6 @@ { ::DestroyWindow(fHWND); ZAssert(not fHWND); - //fHWND = nullptr; } ZCaller_EventLoop::Finalize(); @@ -64,18 +63,21 @@ { ::DestroyWindow(fHWND); ZAssert(not fHWND); - //fHWND = nullptr; } ZCaller_EventLoop::pDiscardPending(); } -static UINT spMSG_Invoke = ::RegisterWindowMessageW(L"ZCaller_WinMessageLoop::Invoke"); +static UINT spGetMSG() + { + static UINT spMSG = ::RegisterWindowMessageW(L"ZCaller_WinMessageLoop::Invoke"); + return spMSG; + } bool ZCaller_WinMessageLoop::pTrigger() { if (fHWND) { - ::PostMessageW(fHWND, spMSG_Invoke, 0, 0); + ::PostMessageW(fHWND, spGetMSG(), 0, 0); return true; } return false; @@ -84,7 +86,7 @@ LRESULT ZCaller_WinMessageLoop::pWindowProc (WNDPROC iWNDPROC, HWND iHWND, UINT iMessage, WPARAM iWPARAM, LPARAM iLPARAM) { - if (iMessage == spMSG_Invoke) + if (iMessage == spGetMSG()) { ZCaller_EventLoop::pCall(); return 0; Modified: trunk/zoolib/source/cxx/zoolib/ZPromise.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZPromise.h 2011-10-24 14:46:25 UTC (rev 2588) +++ trunk/zoolib/source/cxx/zoolib/ZPromise.h 2011-10-24 15:17:31 UTC (rev 2589) @@ -140,9 +140,8 @@ bool QDeliver(const T& iVal) { ZAcqMtx acq(fDelivery->fMtx); - if (fDelivery->fVal) + if (not fDelivery->fVal.QSet(iVal)) return false; - fDelivery->fVal.Set(iVal); fDelivery->fCnd.Broadcast(); return true; } @@ -190,9 +189,8 @@ bool QDeliver() { ZAcqMtx acq(fDelivery->fMtx); - if (fDelivery->fVal) + if (not fDelivery->fVal.QSet()) return false; - fDelivery->fVal.Set(); fDelivery->fCnd.Broadcast(); return true; } Modified: trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.cpp =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.cpp 2011-10-24 14:46:25 UTC (rev 2588) +++ trunk/zoolib/source/cxx/zoolib/ZUtil_CarbonEvents.cpp 2011-10-24 15:17:31 UTC (rev 2589) @@ -32,7 +32,7 @@ using std::string; -#if defined(UNIVERSAL_INTERFACES_VERSION) && UNIVERSAL_INTERFACES_VERSION <= 0x0341 +#if !defined(UNIVERSAL_INTERFACES_VERSION) || UNIVERSAL_INTERFACES_VERSION <= 0x0341 #define USING_ANCIENT_HEADERS 1 #else #define USING_ANCIENT_HEADERS 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-24 14:46:31
|
Revision: 2588 http://zoolib.svn.sourceforge.net/zoolib/?rev=2588&view=rev Author: agreen Date: 2011-10-24 14:46:25 +0000 (Mon, 24 Oct 2011) Log Message: ----------- Add QSet -- return true if we previously had no value and have set the value, false otherwise. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZQ.h Modified: trunk/zoolib/source/cxx/zoolib/ZQ.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZQ.h 2011-10-24 14:39:33 UTC (rev 2587) +++ trunk/zoolib/source/cxx/zoolib/ZQ.h 2011-10-24 14:46:25 UTC (rev 2588) @@ -271,6 +271,15 @@ } } + bool QSet(const T& iVal) + { + if (fHasValue) + return false; + sCtor_T<T>(fBytes, iVal); + fHasValue = true; + return true; + } + T& OParam() { if (fHasValue) @@ -376,6 +385,14 @@ void Set() { fHasValue = true; } + bool QSet() + { + if (fHasValue) + return false; + fHasValue = true; + return true; + } + private: bool fHasValue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2011-10-24 14:39:40
|
Revision: 2587 http://zoolib.svn.sourceforge.net/zoolib/?rev=2587&view=rev Author: agreen Date: 2011-10-24 14:39:33 +0000 (Mon, 24 Oct 2011) Log Message: ----------- The short method names Get/Set were punchy, but because promises and their deliveries are often mixed up with ZQ and ZVal stuff things often got confusing. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCallByCaller.h trunk/zoolib/source/cxx/zoolib/ZPromise.h Modified: trunk/zoolib/source/cxx/zoolib/ZCallByCaller.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCallByCaller.h 2011-10-24 14:14:21 UTC (rev 2586) +++ trunk/zoolib/source/cxx/zoolib/ZCallByCaller.h 2011-10-24 14:39:33 UTC (rev 2587) @@ -37,7 +37,7 @@ template <class T> void spCallWithPromise_T (const ZRef<ZPromise<ZQ<T> > >& iPromise, const ZRef<ZCallable<T(void)> >& iCallable) - { iPromise->Set(sQCall(iCallable)); } + { iPromise->Deliver(sQCall(iCallable)); } template <class T> ZRef<ZDelivery<ZQ<T> > > sCallByCaller @@ -46,7 +46,7 @@ ZRef<ZPromise<ZQ<T> > > thePromise = sPromise<ZQ<T> >(); if (iCaller) iCaller->Queue(sBindR(sCallable(spCallWithPromise_T<T>), thePromise, iCallable)); - return thePromise->Get(); + return thePromise->GetDelivery(); } } // namespace ZooLib Modified: trunk/zoolib/source/cxx/zoolib/ZPromise.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZPromise.h 2011-10-24 14:14:21 UTC (rev 2586) +++ trunk/zoolib/source/cxx/zoolib/ZPromise.h 2011-10-24 14:39:33 UTC (rev 2587) @@ -108,7 +108,7 @@ #pragma mark - #pragma mark * ZPromise -template <class T> +template <class T = void> class ZPromise : public ZCountedWithoutFinalize { @@ -124,20 +124,20 @@ fDelivery->fCnd.Broadcast(); } - bool IsSet() + bool IsDelivered() { ZAcqMtx acq(fDelivery->fMtx); return fDelivery->fVal; } - void Set(const T& iVal) + void Deliver(const T& iVal) { ZAcqMtx acq(fDelivery->fMtx); fDelivery->fVal.Set(iVal); fDelivery->fCnd.Broadcast(); } - bool SetIfNotSet(const T& iVal) + bool QDeliver(const T& iVal) { ZAcqMtx acq(fDelivery->fMtx); if (fDelivery->fVal) @@ -147,7 +147,7 @@ return true; } - ZRef<ZDelivery<T> > Get() + ZRef<ZDelivery<T> > GetDelivery() { return fDelivery; } private: @@ -174,20 +174,20 @@ fDelivery->fCnd.Broadcast(); } - bool IsSet() + bool IsDelivered() { ZAcqMtx acq(fDelivery->fMtx); return fDelivery->fVal; } - void Set() + void Deliver() { ZAcqMtx acq(fDelivery->fMtx); fDelivery->fVal.Set(); fDelivery->fCnd.Broadcast(); } - bool SetIfNotSet() + bool QDeliver() { ZAcqMtx acq(fDelivery->fMtx); if (fDelivery->fVal) @@ -197,7 +197,7 @@ return true; } - ZRef<ZDelivery<void> > Get() + ZRef<ZDelivery<void> > GetDelivery() { return fDelivery; } private: @@ -208,6 +208,10 @@ #pragma mark - #pragma mark * sPromise +inline +ZRef<ZPromise<void> > sPromise() + { return new ZPromise<void>; } + template <class T> ZRef<ZPromise<T> > sPromise() { return new ZPromise<T>; } @@ -217,9 +221,9 @@ #pragma mark * sGetClear template <class T> -ZRef<ZDelivery<T> > sGetClear(ZRef<ZPromise<T> >& ioPromise) +ZRef<ZDelivery<T> > sGetDeliveryClearPromise(ZRef<ZPromise<T> >& ioPromise) { - ZRef<ZDelivery<T> > theDelivery = ioPromise->Get(); + ZRef<ZDelivery<T> > theDelivery = ioPromise->GetDelivery(); ioPromise.Clear(); return theDelivery; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |