objecthandler-cvs Mailing List for ObjectHandler (Page 5)
Brought to you by:
ericehlers,
nando
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(115) |
Jun
(109) |
Jul
(85) |
Aug
(49) |
Sep
(19) |
Oct
(105) |
Nov
(16) |
Dec
(43) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(63) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Eric E. <eri...@us...> - 2006-12-03 14:35:06
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/ohxllib In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27272/ohxl/ohxllib Modified Files: ohxllib.vcproj ohxllib_vc8.vcproj Log Message: ohDemoObject() Index: ohxllib_vc8.vcproj =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/ohxllib/ohxllib_vc8.vcproj,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ohxllib_vc8.vcproj 19 Nov 2006 13:08:27 -0000 1.16 --- ohxllib_vc8.vcproj 3 Dec 2006 14:35:03 -0000 1.17 *************** *** 329,332 **** --- 329,336 ---- > <File + RelativePath="..\..\oh\demo.hpp" + > + </File> + <File RelativePath="..\..\oh\exception.cpp" > *************** *** 401,404 **** --- 405,420 ---- </File> </Filter> + <Filter + Name="ValueObjects" + > + <File + RelativePath="..\..\oh\ValueObjects\vo_demo.cpp" + > + </File> + <File + RelativePath="..\..\oh\ValueObjects\vo_demo.hpp" + > + </File> + </Filter> </Filter> <Filter *************** *** 457,460 **** --- 473,480 ---- > <File + RelativePath="..\Functions\demo.cpp" + > + </File> + <File RelativePath="..\Functions\export.hpp" > *************** *** 465,469 **** </File> <File ! RelativePath="..\Functions\functions.cpp" > </File> --- 485,493 ---- </File> <File ! RelativePath="..\Functions\garbagecollection.cpp" ! > ! </File> ! <File ! RelativePath="..\Functions\logging.cpp" > </File> *************** *** 472,475 **** --- 496,543 ---- > </File> + <File + RelativePath="..\Functions\utilities.cpp" + > + <FileConfiguration + Name="Debug CRTDLL|Win32" + > + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)\$(InputName)1.obj" + XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)\$(InputName)1.obj" + XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" + /> + </FileConfiguration> + <FileConfiguration + Name="Release CRTDLL|Win32" + > + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)\$(InputName)1.obj" + XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)\$(InputName)1.obj" + XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\Functions\valueobjects.cpp" + > + </File> </Filter> <Filter *************** *** 485,489 **** </File> <File ! RelativePath="..\Register\register_functions.cpp" > </File> --- 553,573 ---- </File> <File ! RelativePath="..\Register\register_demo.cpp" ! > ! </File> ! <File ! RelativePath="..\Register\register_garbagecollection.cpp" ! > ! </File> ! <File ! RelativePath="..\Register\register_logging.cpp" ! > ! </File> ! <File ! RelativePath="..\Register\register_utilities.cpp" ! > ! </File> ! <File ! RelativePath="..\Register\register_valueobjects.cpp" > </File> Index: ohxllib.vcproj =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/ohxllib/ohxllib.vcproj,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ohxllib.vcproj 19 Nov 2006 13:08:27 -0000 1.14 --- ohxllib.vcproj 3 Dec 2006 14:35:03 -0000 1.15 *************** *** 338,341 **** --- 338,344 ---- Filter=""> <File + RelativePath="..\..\oh\demo.hpp"> + </File> + <File RelativePath="..\..\oh\exception.cpp"> </File> *************** *** 394,397 **** --- 397,410 ---- </File> </Filter> + <Filter + Name="ValueObjects" + Filter=""> + <File + RelativePath="..\..\oh\ValueObjects\vo_demo.cpp"> + </File> + <File + RelativePath="..\..\oh\ValueObjects\vo_demo.hpp"> + </File> + </Filter> </Filter> <Filter *************** *** 439,442 **** --- 452,458 ---- Filter=""> <File + RelativePath="..\Functions\demo.cpp"> + </File> + <File RelativePath="..\Functions\export.hpp"> </File> *************** *** 445,453 **** </File> <File ! RelativePath="..\Functions\functions.cpp"> </File> <File RelativePath="..\Functions\manual.cpp"> </File> </Filter> <Filter --- 461,514 ---- </File> <File ! RelativePath="..\Functions\garbagecollection.cpp"> ! </File> ! <File ! RelativePath="..\Functions\logging.cpp"> </File> <File RelativePath="..\Functions\manual.cpp"> </File> + <File + RelativePath="..\Functions\utilities.cpp"> + <FileConfiguration + Name="Debug CRTDLL|Win32"> + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)/$(InputName)1.obj"/> + </FileConfiguration> + <FileConfiguration + Name="Release SingleThread|Win32"> + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)/$(InputName)1.obj"/> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32"> + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)/$(InputName)1.obj"/> + </FileConfiguration> + <FileConfiguration + Name="Release CRTDLL|Win32"> + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)/$(InputName)1.obj"/> + </FileConfiguration> + <FileConfiguration + Name="Debug|Win32"> + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)/$(InputName)1.obj"/> + </FileConfiguration> + <FileConfiguration + Name="Debug SingleThread|Win32"> + <Tool + Name="VCCLCompilerTool" + ObjectFile="$(IntDir)/$(InputName)1.obj"/> + </FileConfiguration> + </File> + <File + RelativePath="..\Functions\valueobjects.cpp"> + </File> </Filter> <Filter *************** *** 492,496 **** </File> <File ! RelativePath="..\Register\register_functions.cpp"> </File> </Filter> --- 553,569 ---- </File> <File ! RelativePath="..\Register\register_demo.cpp"> ! </File> ! <File ! RelativePath="..\Register\register_garbagecollection.cpp"> ! </File> ! <File ! RelativePath="..\Register\register_logging.cpp"> ! </File> ! <File ! RelativePath="..\Register\register_utilities.cpp"> ! </File> ! <File ! RelativePath="..\Register\register_valueobjects.cpp"> </File> </Filter> |
From: Eric E. <eri...@us...> - 2006-12-03 14:35:06
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Register In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27272/ohxl/Register Modified Files: .cvsignore Log Message: ohDemoObject() Index: .cvsignore =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Register/.cvsignore,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .cvsignore 3 Oct 2006 12:59:24 -0000 1.3 --- .cvsignore 3 Dec 2006 14:35:03 -0000 1.4 *************** *** 1,2 **** ! register_all.cpp ! register_functions.cpp --- 1 ---- ! register_*.cpp |
From: Eric E. <eri...@us...> - 2006-12-03 14:35:06
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Functions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27272/ohxl/Functions Modified Files: .cvsignore Log Message: ohDemoObject() Index: .cvsignore =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Functions/.cvsignore,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** .cvsignore 16 Nov 2006 12:38:41 -0000 1.4 --- .cvsignore 3 Dec 2006 14:35:03 -0000 1.5 *************** *** 1,3 **** ! functions.cpp functioncount.hpp ! export.hpp \ No newline at end of file --- 1,7 ---- ! demo.cpp ! export.hpp functioncount.hpp ! garbagecollection.cpp ! logging.cpp ! utilities.cpp ! valueobjects.cpp |
From: Eric E. <eri...@us...> - 2006-12-03 14:35:06
|
Update of /cvsroot/objecthandler/ObjectHandler/gensrc/scripts In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27272/gensrc/scripts Modified Files: gensrc.py Log Message: ohDemoObject() Index: gensrc.py =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/gensrc/scripts/gensrc.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gensrc.py 4 Oct 2006 12:04:56 -0000 1.3 --- gensrc.py 3 Dec 2006 14:35:02 -0000 1.4 *************** *** 20,23 **** --- 20,24 ---- import addindoxygen import utilities + import valueobjects config.Config.getInstance().initialize() *************** *** 26,29 **** --- 27,31 ---- addins.append(utilities.serializeObject(addinexcel.AddinExcel)) addins.append(utilities.serializeObject(addindoxygen.AddinDoxygen)) + addins.append(utilities.serializeObject(valueobjects.ValueObjects)) utilities.generate(addins) |
From: Eric E. <eri...@us...> - 2006-12-03 14:35:05
|
Update of /cvsroot/objecthandler/ObjectHandler/Examples/xl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27272/Examples/xl Modified Files: addinstatic.cpp Log Message: ohDemoObject() Index: addinstatic.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/Examples/xl/addinstatic.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** addinstatic.cpp 4 Oct 2006 09:37:43 -0000 1.15 --- addinstatic.cpp 3 Dec 2006 14:35:02 -0000 1.16 *************** *** 19,23 **** #include <ohxl/objhandlerxl.hpp> #include <ohxl/Register/register_all.hpp> ! #include <ohxl/export.hpp> /* Use BOOST_MSVC instead of _MSC_VER since some other vendors (Metrowerks, --- 19,23 ---- #include <ohxl/objhandlerxl.hpp> #include <ohxl/Register/register_all.hpp> ! #include <ohxl/Functions/export.hpp> /* Use BOOST_MSVC instead of _MSC_VER since some other vendors (Metrowerks, |
From: Eric E. <eri...@us...> - 2006-12-03 14:23:42
|
Update of /cvsroot/objecthandler/ObjectHandler/oh/ValueObjects In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22855/ValueObjects Log Message: Directory /cvsroot/objecthandler/ObjectHandler/oh/ValueObjects added to the repository |
From: Eric E. <eri...@us...> - 2006-11-22 21:37:12
|
Update of /cvsroot/objecthandler/ObjectHandler/oh/Conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15203/oh/Conversions Modified Files: coerce.hpp Log Message: support for coercion Index: coerce.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/oh/Conversions/coerce.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** coerce.hpp 19 Nov 2006 13:08:27 -0000 1.1 --- coerce.hpp 22 Nov 2006 21:37:10 -0000 1.2 *************** *** 36,43 **** conversion++; } ! std::ostringstream msg; ! msg << "Unable to coerce value to type " ! << typeid(TypeOut).name(); ! throw Exception(msg.str()); } --- 36,49 ---- conversion++; } ! OH_FAIL("Unable to coerce value to type " ! << typeid(TypeOut).name()); ! } ! ! TypeOut operator()(const TypeIn &in, const TypeOut &defaultValue) { ! if (inputMissing(in)) { ! return defaultValue; ! } else { ! return this->operator()(in); ! } } *************** *** 45,48 **** --- 51,55 ---- typedef bool (*Conversion)(const TypeIn&, TypeOut&); virtual Conversion *getConversions() = 0; + virtual bool inputMissing(const TypeIn&) { return false; } }; |
From: Francois du V. <fd...@us...> - 2006-11-20 18:32:58
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32411 Modified Files: opertoscalar.cpp Log Message: stringLength bug fixed Index: opertoscalar.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/opertoscalar.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** opertoscalar.cpp 19 Nov 2006 13:08:27 -0000 1.2 --- opertoscalar.cpp 20 Nov 2006 18:32:50 -0000 1.3 *************** *** 65,79 **** } ! if (xString->val.str[0]) ! ret.assign(xString->val.str + 1, xString->val.str[0]); // expirimental workaround for apparent bug in Excel API // where the value for the string length wraps around the byte ! //int stringLength = xString->val.str[0]; ! //if (stringLength < 0) stringLength += 257; ! //if (stringLength) ! // ret.assign(xString->val.str + 1, stringLength); ! if (needToFree) Excel(xlFree, 0, 1, &xTemp); } catch (...) { --- 65,80 ---- } ! //if (xString->val.str[0]) ! // ret.assign(xString->val.str + 1, xString->val.str[0]); // expirimental workaround for apparent bug in Excel API // where the value for the string length wraps around the byte ! int stringLength = xString->val.str[0]; ! if (stringLength < 0) stringLength += 256; ! if (stringLength) ! ret.assign(xString->val.str + 1, stringLength); ! if (needToFree) { Excel(xlFree, 0, 1, &xTemp); + } } catch (...) { |
From: Eric E. <eri...@us...> - 2006-11-20 17:59:36
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11764/ohxl/Conversions Modified Files: opertoscalar.hpp Log Message: use default value if input is #NA Index: opertoscalar.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/opertoscalar.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** opertoscalar.hpp 19 Nov 2006 13:08:27 -0000 1.2 --- opertoscalar.hpp 20 Nov 2006 17:41:57 -0000 1.3 *************** *** 34,38 **** const T &defaultValue, const std::string paramName) { ! if (xScalar.xltype & xltypeMissing) return defaultValue; try { --- 34,39 ---- const T &defaultValue, const std::string paramName) { ! if ((xScalar.xltype & xltypeMissing) ! || ((xScalar.xltype & xltypeErr) && (xScalar.val.err == xlerrNA))) return defaultValue; try { |
From: Eric E. <eri...@us...> - 2006-11-19 16:00:37
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31324/ohxl/Conversions Modified Files: validations.cpp Log Message: fix access violation Index: validations.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/validations.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** validations.cpp 16 Nov 2006 12:38:42 -0000 1.1 --- validations.cpp 19 Nov 2006 16:00:34 -0000 1.2 *************** *** 55,59 **** DLL_API void stringToChar(char *c, const std::string &value) { ! int len = __min(XL_MAX_STR_LEN, value.length()); strncpy(c, value.c_str(), len); c[len] = 0; --- 55,59 ---- DLL_API void stringToChar(char *c, const std::string &value) { ! int len = __min(XL_MAX_STR_LEN - 1, value.length()); strncpy(c, value.c_str(), len); c[len] = 0; |
From: Eric E. <eri...@us...> - 2006-11-19 13:08:35
|
Update of /cvsroot/objecthandler/ObjectHandler/oh/Conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29592/oh/Conversions Added Files: coerce.hpp Log Message: support for coercion --- NEW FILE: coerce.hpp --- /* Copyright (C) 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #ifndef oh_conversions_coerce_hpp #define oh_conversions_coerce_hpp #include <oh/exception.hpp> #include <sstream> namespace ObjHandler { template <class TypeIn, class TypeOut> class Coerce { public: TypeOut operator()(const TypeIn &in) { Conversion *conversion = getConversions(); TypeOut out; while (conversion) { if ((*conversion)(in, out)) return out; conversion++; } std::ostringstream msg; msg << "Unable to coerce value to type " << typeid(TypeOut).name(); throw Exception(msg.str()); } protected: typedef bool (*Conversion)(const TypeIn&, TypeOut&); virtual Conversion *getConversions() = 0; }; } #endif |
From: Eric E. <eri...@us...> - 2006-11-19 13:08:31
|
Update of /cvsroot/objecthandler/ObjectHandler/oh In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29592/oh Modified Files: exception.hpp Log Message: support for coercion Index: exception.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/oh/exception.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** exception.hpp 19 May 2006 15:12:41 -0000 1.1 --- exception.hpp 19 Nov 2006 13:08:26 -0000 1.2 *************** *** 27,30 **** --- 27,44 ---- #include <string> + #define OH_FAIL(message) \ + do { \ + std::ostringstream _oh_msg_stream; \ + _oh_msg_stream << message; \ + throw ObjHandler::Exception(_oh_msg_stream.str()); \ + } while (false) + + #define OH_REQUIRE(condition,message) \ + if (!(condition)) { \ + std::ostringstream _oh_msg_stream; \ + _oh_msg_stream << message; \ + throw ObjHandler::Exception(_oh_msg_stream.str()); \ + } else + namespace ObjHandler { |
From: Eric E. <eri...@us...> - 2006-11-19 13:08:30
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Functions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29592/ohxl/Functions Modified Files: manual.cpp Log Message: support for coercion Index: manual.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Functions/manual.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** manual.cpp 16 Nov 2006 12:38:41 -0000 1.7 --- manual.cpp 19 Nov 2006 13:08:27 -0000 1.8 *************** *** 32,35 **** --- 32,64 ---- #define SET_SESSION_ID + void operToOper(OPER *xTarget, const OPER *xSource) { + if (xSource->xltype == xltypeNum) { + xTarget->xltype = xltypeNum; + xTarget->val.num = xSource->val.num; + return; + } else if (xSource->xltype == xltypeStr) { + int len = xSource->val.str[0]; + xTarget->val.str = new char[ len + 1 ]; + if (!xTarget->val.str) + throw ObjHandler::Exception("operToOper: error calling new"); + xTarget->xltype = xltypeStr | xlbitDLLFree; + xTarget->val.str[0] = len; + if (len) + strncpy(xTarget->val.str + 1, xSource->val.str + 1, len); + return; + } else if (xSource->xltype == xltypeErr) { + xTarget->xltype = xltypeErr; + xTarget->val.err = xSource->val.err; + return; + } else if (xSource->xltype == xltypeNil) { + xTarget->xltype = xltypeNil; + return; + } else { + std::ostringstream msg; + msg << "operToOper: unexpected OPER type: " << xSource->xltype; + throw ObjHandler::Exception(msg.str()); + } + } + XLL_DEC long *ohDependsOn( XLOPER *dummy0, *************** *** 92,96 **** } ! int countValidRows(const XLOPER &xMulti) { for (int numValidRows=xMulti.val.array.rows; numValidRows; numValidRows--) { for (int i=0; i<xMulti.val.array.columns; i++) { --- 121,125 ---- } ! int countValidRows(const OPER &xMulti) { for (int numValidRows=xMulti.val.array.rows; numValidRows; numValidRows--) { for (int i=0; i<xMulti.val.array.columns; i++) { *************** *** 103,107 **** } ! int countValidCols(const XLOPER &xMulti) { for (int numValidCols=xMulti.val.array.columns; numValidCols; numValidCols--) { for (int i=0; i<xMulti.val.array.rows; i++) { --- 132,136 ---- } ! int countValidCols(const OPER &xMulti) { for (int numValidCols=xMulti.val.array.columns; numValidCols; numValidCols--) { for (int i=0; i<xMulti.val.array.rows; i++) { *************** *** 114,122 **** } ! XLL_DEC XLOPER *ohPack(OPER *xInputRange) { boost::shared_ptr < ObjHandler::FunctionCall > functionCall; ! XLOPER xMulti; ! static XLOPER xRet; xRet.val.array.lparray = 0; --- 143,151 ---- } ! XLL_DEC OPER *ohPack(OPER *xInputRange) { boost::shared_ptr < ObjHandler::FunctionCall > functionCall; ! OPER xMulti; ! static OPER xRet; xRet.val.array.lparray = 0; *************** *** 132,136 **** xRet.val.array.rows = numValidRows; xRet.val.array.columns = numValidCols; ! xRet.val.array.lparray = new XLOPER[numValidRows * numValidCols]; if (!xRet.val.array.lparray) throw ObjHandler::Exception("ohPack: error on call to new"); --- 161,165 ---- xRet.val.array.rows = numValidRows; xRet.val.array.columns = numValidCols; ! xRet.val.array.lparray = new OPER[numValidRows * numValidCols]; if (!xRet.val.array.lparray) throw ObjHandler::Exception("ohPack: error on call to new"); *************** *** 141,145 **** int indexSource = i * xMulti.val.array.columns + j; int indexTarget = i * numValidCols + j; ! ObjHandler::operToOper(&xRet.val.array.lparray[indexTarget], &xMulti.val.array.lparray[indexSource]); } --- 170,174 ---- int indexSource = i * xMulti.val.array.columns + j; int indexTarget = i * numValidCols + j; ! operToOper(&xRet.val.array.lparray[indexTarget], &xMulti.val.array.lparray[indexSource]); } *************** *** 169,173 **** } ! XLL_DEC XLOPER *ohParseField( char *line, long *index, --- 198,202 ---- } ! XLL_DEC OPER *ohParseField( char *line, long *index, *************** *** 187,195 **** // convert the inputs ! std::string typeStr; ! ObjHandler::operToScalar(typeStr, *type, "NUMBER"); ! std::string delimStr; ! ObjHandler::operToScalar(delimStr, *delim, "[:space:]"); // invoke the utility function --- 216,224 ---- // convert the inputs ! std::string typeStr = ! ObjHandler::operToScalar<std::string>(*type, "NUMBER", "type"); ! std::string delimStr = ! ObjHandler::operToScalar<std::string>(*delim, "[:space:]", "delim"); // invoke the utility function *************** *** 213,217 **** } ! static XLOPER xRet; if (typeStr.empty() || ObjHandler::uppercase(typeStr) == "NUMBER") { --- 242,246 ---- } ! static OPER xRet; if (typeStr.empty() || ObjHandler::uppercase(typeStr) == "NUMBER") { *************** *** 227,233 **** throw ObjHandler::Exception(msg.str()); } ! ObjHandler::scalarToXloper(xRet, ret); } else if (ObjHandler::uppercase(typeStr) == "STRING") { ! ObjHandler::scalarToXloper(xRet, fields[i-1]); } else { std::stringstream msg; --- 256,262 ---- throw ObjHandler::Exception(msg.str()); } ! ObjHandler::scalarToOper(xRet, ret); } else if (ObjHandler::uppercase(typeStr) == "STRING") { ! ObjHandler::scalarToOper(xRet, fields[i-1]); } else { std::stringstream msg; |
From: Eric E. <eri...@us...> - 2006-11-19 13:08:30
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29592/ohxl/Conversions Modified Files: all.hpp matrixtooper.hpp opertomatrix.hpp opertoscalar.cpp opertoscalar.hpp opertovector.hpp scalartooper.cpp scalartooper.hpp validations.hpp vectortooper.hpp Log Message: support for coercion Index: all.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/all.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** all.hpp 16 Nov 2006 12:38:42 -0000 1.1 --- all.hpp 19 Nov 2006 13:08:26 -0000 1.2 *************** *** 19,22 **** --- 19,23 ---- #define ohxl_conversions_all_hpp + #include <oh/Conversions/coerce.hpp> #include <ohxl/Conversions/opertoscalar.hpp> #include <ohxl/Conversions/opertovector.hpp> Index: scalartooper.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/scalartooper.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** scalartooper.hpp 16 Nov 2006 12:38:42 -0000 1.1 --- scalartooper.hpp 19 Nov 2006 13:08:27 -0000 1.2 *************** *** 26,37 **** namespace ObjHandler { ! DLL_API void scalarToXloper(XLOPER &xLong, const long &value); ! DLL_API void scalarToXloper(XLOPER &xDouble, const double &value); ! DLL_API void scalarToXloper(XLOPER &xBoolean, const bool &value); ! DLL_API void scalarToXloper(XLOPER &xString, const std::string &value); ! DLL_API void scalarToXloper( ! XLOPER &xAny, ! const boost::any &value, ! const bool &expandVectors = true); } --- 26,34 ---- namespace ObjHandler { ! DLL_API void scalarToOper(OPER &xLong, const long &value); ! DLL_API void scalarToOper(OPER &xDouble, const double &value); ! DLL_API void scalarToOper(OPER &xBoolean, const bool &value); ! DLL_API void scalarToOper(OPER &xString, const std::string &value); ! DLL_API void scalarToOper(OPER &xAny, const boost::any &value); } Index: opertomatrix.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/opertomatrix.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** opertomatrix.hpp 16 Nov 2006 12:38:42 -0000 1.1 --- opertomatrix.hpp 19 Nov 2006 13:08:27 -0000 1.2 *************** *** 31,35 **** std::vector<std::vector<T> > ret; if (xMatrix.xltype & xltypeErr) ! throw Exception("input value is #NULL (xltypeErr)"); if (xMatrix.xltype & (xltypeMissing | xltypeNil)) return ret; --- 31,35 ---- std::vector<std::vector<T> > ret; if (xMatrix.xltype & xltypeErr) ! throw Exception("input value has type=error"); if (xMatrix.xltype & (xltypeMissing | xltypeNil)) return ret; Index: opertoscalar.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/opertoscalar.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** opertoscalar.cpp 16 Nov 2006 12:38:42 -0000 1.1 --- opertoscalar.cpp 19 Nov 2006 13:08:27 -0000 1.2 *************** *** 18,101 **** #include <ohxl/Conversions/opertoscalar.hpp> - #include <oh/exception.hpp> - #include <oh/utilities.hpp> - #include <sstream> namespace ObjHandler { ! DLL_API void operToScalar(long &ret, const OPER &xScalar, const long &defaultValue) { ! try { ! //if (xScalar.xltype & xltypeErr) ! // throw Exception("input value is #NULL (xltypeErr)"); ! //if (xScalar.xltype & (xltypeMissing | xltypeNil)) ! if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) ! ret = defaultValue; ! else if (xScalar.xltype == xltypeNum) ! ret = xScalar.val.num; ! else { ! OPER xLong; ! Excel(xlCoerce, &xLong, 2, &xScalar, TempInt(xltypeInt)); ! ret = xLong.val.w; ! } ! } catch (const std::exception &e) { ! std::ostringstream msg; ! msg << "operToScalar cannot coerce to long: " << e.what(); ! throw Exception(msg.str()); } } ! DLL_API void operToScalar(double &ret, const OPER &xScalar, const double &defaultValue) { ! try { ! //if (xScalar.xltype & xltypeErr) ! // throw Exception("input value is #NULL (xltypeErr)"); ! //if (xScalar.xltype & (xltypeMissing | xltypeNil)) ! if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) ! ret = defaultValue; ! else if (xScalar.xltype == xltypeNum) ! ret = xScalar.val.num; ! else { ! OPER xDouble; ! Excel(xlCoerce, &xDouble, 2, &xScalar, TempInt(xltypeNum)); ! ret = xDouble.val.num; ! } ! } catch (const std::exception &e) { ! std::ostringstream msg; ! msg << "operToScalar cannot coerce to double: " << e.what(); ! throw Exception(msg.str()); } } ! DLL_API void operToScalar(bool &ret, const OPER &xScalar, const bool &defaultValue) { ! try { ! //if (xScalar.xltype & xltypeErr) ! // throw Exception("input value is #NULL (xltypeErr)"); ! //if (xScalar.xltype & (xltypeMissing | xltypeNil)) ! if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) ! ret = defaultValue; ! else if (xScalar.xltype == xltypeBool) ! ret = xScalar.val.boolean != 0; ! else { ! OPER xBool; ! Excel(xlCoerce, &xBool, 2, &xScalar, TempInt(xltypeBool)); ! ret = xBool.val.boolean != 0; ! } ! } catch (const std::exception &e) { ! std::ostringstream msg; ! msg << "operToScalar cannot coerce to bool: " << e.what(); ! throw Exception(msg.str()); } } ! DLL_API void operToScalar(std::string &ret, const OPER &xScalar, const std::string &defaultValue) { OPER xTemp; bool needToFree = false; try { - //if (xScalar.xltype & xltypeErr) - // throw Exception("input value is #NULL (xltypeErr)"); - //if (xScalar.xltype & (xltypeMissing | xltypeNil)) - if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) { - ret = defaultValue; - return; - } const OPER *xString; --- 18,58 ---- #include <ohxl/Conversions/opertoscalar.hpp> namespace ObjHandler { ! DLL_API void operToScalar(long &ret, const OPER &xScalar) { ! if (xScalar.xltype == xltypeNum) ! ret = xScalar.val.num; ! else { ! OPER xLong; ! Excel(xlCoerce, &xLong, 2, &xScalar, TempInt(xltypeInt)); ! ret = xLong.val.w; } } ! DLL_API void operToScalar(double &ret, const OPER &xScalar) { ! if (xScalar.xltype == xltypeNum) ! ret = xScalar.val.num; ! else { ! OPER xDouble; ! Excel(xlCoerce, &xDouble, 2, &xScalar, TempInt(xltypeNum)); ! ret = xDouble.val.num; } } ! DLL_API void operToScalar(bool &ret, const OPER &xScalar) { ! if (xScalar.xltype == xltypeBool) ! ret = xScalar.val.boolean != 0; ! else { ! OPER xBool; ! Excel(xlCoerce, &xBool, 2, &xScalar, TempInt(xltypeBool)); ! ret = xBool.val.boolean != 0; } } ! DLL_API void operToScalar(std::string &ret, const OPER &xScalar) { OPER xTemp; bool needToFree = false; try { const OPER *xString; *************** *** 108,180 **** } ! //if (xString->val.str[0]) ! // ret.assign(xString->val.str + 1, xString->val.str[0]); ! // expirimental workaround for apparent bug in Excel API // where the value for the string length wraps around the byte ! ! int stringLength = xString->val.str[0]; ! if (stringLength < 0) stringLength += 257; ! if (stringLength) ! ret.assign(xString->val.str + 1, stringLength); if (needToFree) Excel(xlFree, 0, 1, &xTemp); ! } catch (const std::exception &e) { if (needToFree) Excel(xlFree, 0, 1, &xTemp); ! std::ostringstream msg; ! msg << "operToScalar cannot coerce to string: " << e.what(); ! throw Exception(msg.str()); ! } ! } ! ! DLL_API void operToScalar(boost::any &ret, const OPER &xScalar) { ! //if (xScalar.xltype & xltypeErr) ! // throw Exception("input value is #NULL (xltypeErr)"); ! //if (xScalar.xltype & (xltypeMissing | xltypeNil)) ! if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) ! ret = boost::any(); ! //else if (xScalar.xltype & xltypeErr) ! // ret = InvalidInput; ! else if (xScalar.xltype == xltypeNum) ! ret = xScalar.val.num; ! else if (xScalar.xltype == xltypeBool) ! ret = xScalar.val.boolean != 0; ! else if (xScalar.xltype == xltypeStr) { ! std::string value; ! operToScalar(value, xScalar); ! ret = value; ! } else ! throw Exception("operToScalar cannot coerce to boost::any: unexpected datatype"); ! } ! ! void operToOper(OPER *xTarget, const OPER *xSource) { ! if (xSource->xltype == xltypeNum) { ! xTarget->xltype = xltypeNum; ! xTarget->val.num = xSource->val.num; ! return; ! } else if (xSource->xltype == xltypeStr) { ! int len = xSource->val.str[0]; ! xTarget->val.str = new char[ len + 1 ]; ! if (!xTarget->val.str) ! throw Exception("operToOper: error calling new"); ! xTarget->xltype = xltypeStr | xlbitDLLFree; ! xTarget->val.str[0] = len; ! if (len) ! strncpy(xTarget->val.str + 1, xSource->val.str + 1, len); ! return; ! } else if (xSource->xltype == xltypeErr) { ! xTarget->xltype = xltypeErr; ! xTarget->val.err = xSource->val.err; ! return; ! } else if (xSource->xltype == xltypeNil) { ! xTarget->xltype = xltypeNil; ! return; ! } else { ! std::ostringstream msg; ! msg << "operToOper: unexpected OPER type: " << xSource->xltype; ! throw Exception(msg.str()); } } --- 65,84 ---- } ! if (xString->val.str[0]) ! ret.assign(xString->val.str + 1, xString->val.str[0]); // expirimental workaround for apparent bug in Excel API // where the value for the string length wraps around the byte ! //int stringLength = xString->val.str[0]; ! //if (stringLength < 0) stringLength += 257; ! //if (stringLength) ! // ret.assign(xString->val.str + 1, stringLength); if (needToFree) Excel(xlFree, 0, 1, &xTemp); ! } catch (...) { if (needToFree) Excel(xlFree, 0, 1, &xTemp); ! throw; } } Index: matrixtooper.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/matrixtooper.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** matrixtooper.hpp 16 Nov 2006 12:38:42 -0000 1.1 --- matrixtooper.hpp 19 Nov 2006 13:08:27 -0000 1.2 *************** *** 25,32 **** template <class T> ! void matrixToXloper(XLOPER &xMatrix, const std::vector<std::vector<T> > &vv) { if (vv.empty() || vv[0].empty()) { - //xMatrix.xltype = xltypeNum; - //xMatrix.val.num = 0; xMatrix.xltype = xltypeErr; xMatrix.val.err = xlerrNA; --- 25,30 ---- template <class T> ! void matrixToOper(OPER &xMatrix, const std::vector<std::vector<T> > &vv) { if (vv.empty() || vv[0].empty()) { xMatrix.xltype = xltypeErr; xMatrix.val.err = xlerrNA; *************** *** 35,46 **** xMatrix.val.array.rows = vv.size(); xMatrix.val.array.columns = vv[0].size(); ! xMatrix.val.array.lparray = new XLOPER[xMatrix.val.array.rows * xMatrix.val.array.columns]; if (!xMatrix.val.array.lparray) ! throw Exception("matrixToXloper: error on call to new"); xMatrix.xltype = xltypeMulti | xlbitDLLFree; for (unsigned int i=0; i<vv.size(); i++) { std::vector<T> v = vv[i]; for (unsigned int j=0; j<v.size(); j++) ! scalarToXloper(xMatrix.val.array.lparray[i * v.size() + j], v[j]); } } --- 33,44 ---- xMatrix.val.array.rows = vv.size(); xMatrix.val.array.columns = vv[0].size(); ! xMatrix.val.array.lparray = new OPER[xMatrix.val.array.rows * xMatrix.val.array.columns]; if (!xMatrix.val.array.lparray) ! throw Exception("matrixToOper: error on call to new"); xMatrix.xltype = xltypeMulti | xlbitDLLFree; for (unsigned int i=0; i<vv.size(); i++) { std::vector<T> v = vv[i]; for (unsigned int j=0; j<v.size(); j++) ! scalarToOper(xMatrix.val.array.lparray[i * v.size() + j], v[j]); } } Index: opertoscalar.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/opertoscalar.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** opertoscalar.hpp 16 Nov 2006 12:38:42 -0000 1.1 --- opertoscalar.hpp 19 Nov 2006 13:08:27 -0000 1.2 *************** *** 22,35 **** #include <xlsdk/xlsdkdefines.hpp> #include <string> - #include <boost/any.hpp> namespace ObjHandler { ! DLL_API void operToScalar(long &ret, const OPER &xScalar, const long &defaultValue = 0); ! DLL_API void operToScalar(double &ret, const OPER &xScalar, const double &defaultValue = 0.); ! DLL_API void operToScalar(bool &ret, const OPER &xScalar, const bool &defaultValue = false); ! DLL_API void operToScalar(std::string &ret, const OPER &xScalar, const std::string &defaultValue = ""); ! DLL_API void operToScalar(boost::any &ret, const OPER &xScalar); ! void operToOper(OPER *xTarget, const OPER *xSource); } --- 22,53 ---- #include <xlsdk/xlsdkdefines.hpp> #include <string> namespace ObjHandler { ! DLL_API void operToScalar(long &ret, const OPER &xScalar); ! DLL_API void operToScalar(double &ret, const OPER &xScalar); ! DLL_API void operToScalar(bool &ret, const OPER &xScalar); ! DLL_API void operToScalar(std::string &ret, const OPER &xScalar); ! ! template <class T> ! T operToScalar(const OPER &xScalar, ! const T &defaultValue, ! const std::string paramName) { ! if (xScalar.xltype & xltypeMissing) ! return defaultValue; ! try { ! if (xScalar.xltype & xltypeErr) ! throw Exception("input value has type=error"); ! T returnValue; ! operToScalar(returnValue, xScalar); ! return returnValue; ! } catch(const std::exception &e) { ! std::ostringstream msg; ! msg << "unable to convert parameter '" << paramName ! << "' to type " << typeid(T).name() ! << " - " << e.what(); ! throw Exception(msg.str()); ! } ! } } Index: vectortooper.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/vectortooper.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** vectortooper.hpp 16 Nov 2006 12:38:42 -0000 1.1 --- vectortooper.hpp 19 Nov 2006 13:08:27 -0000 1.2 *************** *** 26,33 **** template <class T> ! void vectorToXloper(XLOPER &xVector, const std::vector<T> &v) { if (v.empty()) { - //xVector.xltype = xltypeNum; - //xVector.val.num = 0; xVector.xltype = xltypeErr; xVector.val.err = xlerrNA; --- 26,31 ---- template <class T> ! void vectorToOper(OPER &xVector, const std::vector<T> &v) { if (v.empty()) { xVector.xltype = xltypeErr; xVector.val.err = xlerrNA; *************** *** 42,51 **** xVector.val.array.columns = 1; } ! xVector.val.array.lparray = new XLOPER[v.size()]; if (!xVector.val.array.lparray) ! throw Exception("vectorToXloper: error on call to new"); xVector.xltype = xltypeMulti | xlbitDLLFree; for (unsigned int i=0; i<v.size(); i++) ! scalarToXloper(xVector.val.array.lparray[i], v[i]); } --- 40,49 ---- xVector.val.array.columns = 1; } ! xVector.val.array.lparray = new OPER[v.size()]; if (!xVector.val.array.lparray) ! throw Exception("vectorToOper: error on call to new"); xVector.xltype = xltypeMulti | xlbitDLLFree; for (unsigned int i=0; i<v.size(); i++) ! scalarToOper(xVector.val.array.lparray[i], v[i]); } Index: scalartooper.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/scalartooper.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** scalartooper.cpp 16 Nov 2006 12:38:42 -0000 1.1 --- scalartooper.cpp 19 Nov 2006 13:08:27 -0000 1.2 *************** *** 26,49 **** namespace ObjHandler { ! DLL_API void scalarToXloper(XLOPER &xLong, const long &value) { xLong.xltype = xltypeNum; xLong.val.num = value; } ! DLL_API void scalarToXloper(XLOPER &xDouble, const double &value) { xDouble.xltype = xltypeNum; xDouble.val.num = value; } ! DLL_API void scalarToXloper(XLOPER &xBoolean, const bool &value) { xBoolean.xltype = xltypeBool; xBoolean.val.boolean = value; } ! DLL_API void scalarToXloper(XLOPER &xString, const std::string &value) { int len = __min(XL_MAX_STR_LEN, value.length()); xString.val.str = new char[ len + 1 ]; if (!xString.val.str) ! throw Exception("stringToXloper: error calling new"); xString.xltype = xltypeStr | xlbitDLLFree; xString.val.str[0] = len; --- 26,49 ---- namespace ObjHandler { ! DLL_API void scalarToOper(OPER &xLong, const long &value) { xLong.xltype = xltypeNum; xLong.val.num = value; } ! DLL_API void scalarToOper(OPER &xDouble, const double &value) { xDouble.xltype = xltypeNum; xDouble.val.num = value; } ! DLL_API void scalarToOper(OPER &xBoolean, const bool &value) { xBoolean.xltype = xltypeBool; xBoolean.val.boolean = value; } ! DLL_API void scalarToOper(OPER &xString, const std::string &value) { int len = __min(XL_MAX_STR_LEN, value.length()); xString.val.str = new char[ len + 1 ]; if (!xString.val.str) ! throw Exception("stringToOper: error calling new"); xString.xltype = xltypeStr | xlbitDLLFree; xString.val.str[0] = len; *************** *** 52,64 **** } ! DLL_API void scalarToXloper( ! XLOPER &xAny, ! const boost::any &value, ! const bool &expandVectors) { ! if (value.type() == typeid(XLOPER)) { ! XLOPER xTemp = boost::any_cast<XLOPER>(value); Excel(xlCoerce, &xAny, 1, &xTemp); ! } else if (value.type() == typeid(XLOPER*)) { ! XLOPER *xTemp = boost::any_cast<XLOPER*>(value); Excel(xlCoerce, &xAny, 1, xTemp); } else if (value.type() == typeid(int)) { --- 52,61 ---- } ! DLL_API void scalarToOper(OPER &xAny, const boost::any &value) { ! if (value.type() == typeid(OPER)) { ! OPER xTemp = boost::any_cast<OPER>(value); Excel(xlCoerce, &xAny, 1, &xTemp); ! } else if (value.type() == typeid(OPER*)) { ! OPER *xTemp = boost::any_cast<OPER*>(value); Excel(xlCoerce, &xAny, 1, xTemp); } else if (value.type() == typeid(int)) { *************** *** 76,152 **** } else if (value.type() == typeid(std::string)) { std::string s = boost::any_cast<std::string>(value); ! scalarToXloper(xAny, s); } else if (value.type() == typeid(std::vector<long>)) { ! if (expandVectors) { ! std::vector<long> v= boost::any_cast< std::vector<long> >(value); ! vectorToXloper(xAny, v); ! } else { ! scalarToXloper(xAny, std::string(VECTOR)); ! } } else if (value.type() == typeid(std::vector<double>)) { ! if (expandVectors) { ! std::vector<double> v= boost::any_cast< std::vector<double> >(value); ! vectorToXloper(xAny, v); ! } else { ! scalarToXloper(xAny, std::string(VECTOR)); ! } } else if (value.type() == typeid(std::vector<bool>)) { ! if (expandVectors) { ! std::vector<bool> v= boost::any_cast< std::vector<bool> >(value); ! vectorToXloper(xAny, v); ! } else { ! scalarToXloper(xAny, std::string(VECTOR)); ! } ! } else if (value.type() == typeid(std::vector< std::string >)) { ! if (expandVectors) { ! std::vector< std::string > v= boost::any_cast< std::vector< std::string > >(value); ! vectorToXloper(xAny, v); ! } else { ! scalarToXloper(xAny, std::string(VECTOR)); ! } ! } else if (value.type() == typeid(std::vector< boost::any >)) { ! if (expandVectors) { ! std::vector< boost::any > v= boost::any_cast< std::vector< boost::any > >(value); ! vectorToXloper(xAny, v); ! } else { ! scalarToXloper(xAny, std::string(VECTOR)); ! } ! } else if (value.type() == typeid(std::vector< std::vector< long > >)) { ! if (expandVectors) { ! std::vector< std::vector<long> >vv = boost::any_cast< std::vector< std::vector<long> > >(value); ! vectorToXloper(xAny, vv); ! } else { ! scalarToXloper(xAny, std::string(MATRIX)); ! } ! } else if (value.type() == typeid(std::vector< std::vector< double > >)) { ! if (expandVectors) { ! std::vector< std::vector< double > >vv = boost::any_cast< std::vector< std::vector< double > > >(value); ! matrixToXloper(xAny, vv); ! } else { ! scalarToXloper(xAny, std::string(MATRIX)); ! } ! } else if (value.type() == typeid(std::vector< std::vector< bool > >)) { ! if (expandVectors) { ! std::vector< std::vector< bool > >vv = boost::any_cast< std::vector< std::vector< bool > > >(value); ! // FIXME VC8 compilation fails on this line ! // support for matrix of bools not presently required ! //matrixToXloper(xAny, vv); ! } else { ! scalarToXloper(xAny, std::string(MATRIX)); ! } ! } else if (value.type() == typeid(std::vector< std::vector< std::string > >)) { ! if (expandVectors) { ! std::vector< std::vector< std::string > >vv = boost::any_cast< std::vector< std::vector< std::string > > >(value); ! matrixToXloper(xAny, vv); ! } else { ! scalarToXloper(xAny, std::string(MATRIX)); ! } ! } else if (value.type() == typeid(std::vector< std::vector< boost::any > >)) { ! if (expandVectors) { ! std::vector< std::vector< boost::any > >vv = boost::any_cast< std::vector< std::vector< boost::any > > >(value); ! matrixToXloper(xAny, vv); ! } else { ! scalarToXloper(xAny, std::string(MATRIX)); ! } } else { xAny.xltype = xltypeErr; --- 73,109 ---- } else if (value.type() == typeid(std::string)) { std::string s = boost::any_cast<std::string>(value); ! scalarToOper(xAny, s); } else if (value.type() == typeid(std::vector<long>)) { ! std::vector<long> v = boost::any_cast<std::vector<long> >(value); ! vectorToOper(xAny, v); } else if (value.type() == typeid(std::vector<double>)) { ! std::vector<double> v = boost::any_cast<std::vector<double> >(value); ! vectorToOper(xAny, v); } else if (value.type() == typeid(std::vector<bool>)) { ! std::vector<bool> v = boost::any_cast<std::vector<bool> >(value); ! vectorToOper(xAny, v); ! } else if (value.type() == typeid(std::vector<std::string>)) { ! std::vector<std::string> v = boost::any_cast<std::vector<std::string> >(value); ! vectorToOper(xAny, v); ! } else if (value.type() == typeid(std::vector<boost::any>)) { ! std::vector<boost::any> v = boost::any_cast<std::vector<boost::any> >(value); ! vectorToOper(xAny, v); ! } else if (value.type() == typeid(std::vector<std::vector<long> >)) { ! std::vector<std::vector<long> > vv = boost::any_cast<std::vector<std::vector<long> > >(value); ! vectorToOper(xAny, vv); ! } else if (value.type() == typeid(std::vector<std::vector<double> >)) { ! std::vector<std::vector<double> > vv = boost::any_cast<std::vector<std::vector<double> > >(value); ! matrixToOper(xAny, vv); ! } else if (value.type() == typeid(std::vector<std::vector<bool> >)) { ! std::vector<std::vector<bool> > vv = boost::any_cast<std::vector<std::vector<bool > > >(value); ! // FIXME VC8 compilation fails on this line ! // support for matrix of bools not presently required ! //matrixToOper(xAny, vv); ! } else if (value.type() == typeid(std::vector<std::vector<std::string> >)) { ! std::vector<std::vector<std::string> > vv = boost::any_cast<std::vector<std::vector<std::string> > >(value); ! matrixToOper(xAny, vv); ! } else if (value.type() == typeid(std::vector<std::vector<boost::any> >)) { ! std::vector<std::vector<boost::any> > vv = boost::any_cast<std::vector<std::vector<boost::any> > >(value); ! matrixToOper(xAny, vv); } else { xAny.xltype = xltypeErr; Index: opertovector.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/opertovector.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** opertovector.hpp 16 Nov 2006 12:38:42 -0000 1.1 --- opertovector.hpp 19 Nov 2006 13:08:27 -0000 1.2 *************** *** 31,35 **** std::vector<T> ret; if (xVector.xltype & xltypeErr) ! throw Exception("input value is #NULL (xltypeErr)"); if (xVector.xltype & (xltypeMissing | xltypeNil)) return ret; --- 31,35 ---- std::vector<T> ret; if (xVector.xltype & xltypeErr) ! throw Exception("input value has type=error"); if (xVector.xltype & (xltypeMissing | xltypeNil)) return ret; Index: validations.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions/validations.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** validations.hpp 16 Nov 2006 12:38:42 -0000 1.1 --- validations.hpp 19 Nov 2006 13:08:27 -0000 1.2 *************** *** 21,28 **** #include <oh/objhandlerdefines.hpp> #include <xlsdk/xlsdkdefines.hpp> - #include <ohxl/functioncall.hpp> - #include <vector> #include <string> - #include <boost/any.hpp> namespace ObjHandler { --- 21,25 ---- *************** *** 31,35 **** DLL_API void validateReference(const XLOPER *xReference, const std::string &name); DLL_API void stringToChar(char *c, const std::string &s); - void operToOper(OPER *xTarget, const OPER *xSource); } --- 28,31 ---- |
From: Eric E. <eri...@us...> - 2006-11-19 13:08:30
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/ohxllib In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29592/ohxl/ohxllib Modified Files: ohxllib.vcproj ohxllib_vc8.vcproj Log Message: support for coercion Index: ohxllib_vc8.vcproj =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/ohxllib/ohxllib_vc8.vcproj,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ohxllib_vc8.vcproj 16 Nov 2006 12:38:41 -0000 1.15 --- ohxllib_vc8.vcproj 19 Nov 2006 13:08:27 -0000 1.16 *************** *** 325,388 **** Name="oh" > ! <File ! RelativePath="..\..\oh\auto_link.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\exception.cpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\exception.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\logger.cpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\logger.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\object.cpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\object.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\objecthandler.cpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\objecthandler.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\objhandler.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\objhandlerdefines.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\singleton.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\utilities.cpp" > ! </File> ! <File ! RelativePath="..\..\oh\utilities.hpp" > ! </File> ! <File ! RelativePath="..\..\oh\valueobject.hpp" > ! </File> </Filter> <Filter --- 325,404 ---- Name="oh" > ! <Filter ! Name="Classes" > ! <File ! RelativePath="..\..\oh\exception.cpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\exception.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\object.cpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\object.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\objecthandler.cpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\objecthandler.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\objhandler.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\objhandlerdefines.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\singleton.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\valueobject.hpp" ! > ! </File> ! </Filter> ! <Filter ! Name="Utilities" > ! <File ! RelativePath="..\..\oh\auto_link.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\logger.cpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\logger.hpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\utilities.cpp" ! > ! </File> ! <File ! RelativePath="..\..\oh\utilities.hpp" ! > ! </File> ! </Filter> ! <Filter ! Name="Conversions" > ! <File ! RelativePath="..\..\oh\Conversions\coerce.hpp" ! > ! </File> ! </Filter> </Filter> <Filter Index: ohxllib.vcproj =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/ohxllib/ohxllib.vcproj,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ohxllib.vcproj 16 Nov 2006 12:38:41 -0000 1.13 --- ohxllib.vcproj 19 Nov 2006 13:08:27 -0000 1.14 *************** *** 334,382 **** Name="oh" Filter=""> ! <File ! RelativePath="..\..\oh\auto_link.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\exception.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\exception.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\logger.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\logger.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\object.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\object.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\objecthandler.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\objecthandler.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\objhandler.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\objhandlerdefines.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\singleton.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\utilities.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\utilities.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\valueobject.hpp"> ! </File> </Filter> <Filter --- 334,397 ---- Name="oh" Filter=""> ! <Filter ! Name="Classes" ! Filter=""> ! <File ! RelativePath="..\..\oh\exception.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\exception.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\object.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\object.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\objecthandler.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\objecthandler.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\objhandler.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\objhandlerdefines.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\singleton.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\valueobject.hpp"> ! </File> ! </Filter> ! <Filter ! Name="Conversions" ! Filter=""> ! <File ! RelativePath="..\..\oh\Conversions\coerce.hpp"> ! </File> ! </Filter> ! <Filter ! Name="Utilities" ! Filter=""> ! <File ! RelativePath="..\..\oh\auto_link.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\logger.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\logger.hpp"> ! </File> ! <File ! RelativePath="..\..\oh\utilities.cpp"> ! </File> ! <File ! RelativePath="..\..\oh\utilities.hpp"> ! </File> ! </Filter> </Filter> <Filter |
From: Eric E. <eri...@us...> - 2006-11-19 12:48:43
|
Update of /cvsroot/objecthandler/ObjectHandler/oh/Conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21662/Conversions Log Message: Directory /cvsroot/objecthandler/ObjectHandler/oh/Conversions added to the repository |
From: Eric E. <eri...@us...> - 2006-11-16 12:39:13
|
Update of /cvsroot/objecthandler/ObjectHandler/gensrc/stubs In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17350/gensrc/stubs Modified Files: stub.excel.includes Log Message: consolidate conversion functions in preparation for implementation of coercion Index: stub.excel.includes =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/gensrc/stubs/stub.excel.includes,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stub.excel.includes 3 Oct 2006 09:32:37 -0000 1.6 --- stub.excel.includes 16 Nov 2006 12:38:40 -0000 1.7 *************** *** 2,6 **** #include <oh/exception.hpp> #include <ohxl/objecthandlerxl.hpp> ! #include <ohxl/conversions.hpp> #include <ohxl/functioncall.hpp> #include <sstream> --- 2,6 ---- #include <oh/exception.hpp> #include <ohxl/objecthandlerxl.hpp> ! #include <ohxl/Conversions/all.hpp> #include <ohxl/functioncall.hpp> #include <sstream> |
From: Eric E. <eri...@us...> - 2006-11-16 12:38:48
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17350/ohxl/Conversions Added Files: all.hpp matrixtooper.hpp opertomatrix.hpp opertoscalar.cpp opertoscalar.hpp opertovector.hpp scalartooper.cpp scalartooper.hpp validations.cpp validations.hpp vectortooper.hpp Log Message: consolidate conversion functions in preparation for implementation of coercion --- NEW FILE: all.hpp --- /* Copyright (C) 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #ifndef ohxl_conversions_all_hpp #define ohxl_conversions_all_hpp #include <ohxl/Conversions/opertoscalar.hpp> #include <ohxl/Conversions/opertovector.hpp> #include <ohxl/Conversions/opertomatrix.hpp> #include <ohxl/Conversions/scalartooper.hpp> #include <ohxl/Conversions/vectortooper.hpp> #include <ohxl/Conversions/matrixtooper.hpp> #include <ohxl/Conversions/validations.hpp> #endif --- NEW FILE: scalartooper.hpp --- /* Copyright (C) 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #ifndef ohxl_conversions_scalartooper_hpp #define ohxl_conversions_scalartooper_hpp #include <oh/objhandlerdefines.hpp> #include <xlsdk/xlsdkdefines.hpp> #include <string> #include <boost/any.hpp> namespace ObjHandler { DLL_API void scalarToXloper(XLOPER &xLong, const long &value); DLL_API void scalarToXloper(XLOPER &xDouble, const double &value); DLL_API void scalarToXloper(XLOPER &xBoolean, const bool &value); DLL_API void scalarToXloper(XLOPER &xString, const std::string &value); DLL_API void scalarToXloper( XLOPER &xAny, const boost::any &value, const bool &expandVectors = true); } #endif --- NEW FILE: opertomatrix.hpp --- /* Copyright (C) 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #ifndef ohxl_conversions_opertomatrix_hpp #define ohxl_conversions_opertomatrix_hpp #include <ohxl/Conversions/opertoscalar.hpp> #include <vector> namespace ObjHandler { template <class T> std::vector<std::vector<T> > operToMatrix(const OPER &xMatrix) { OPER xTemp; bool needToFree = false; try { std::vector<std::vector<T> > ret; if (xMatrix.xltype & xltypeErr) throw Exception("input value is #NULL (xltypeErr)"); if (xMatrix.xltype & (xltypeMissing | xltypeNil)) return ret; const OPER *xMulti; if (xMatrix.xltype == xltypeMulti) xMulti = &xMatrix; else { Excel(xlCoerce, &xTemp, 2, &xMatrix, TempInt(xltypeMulti)); xMulti = &xTemp; needToFree = true; } for (int i=0; i<xMulti->val.array.rows; i++) { std::vector<T> row; for (int j=0; j<xMulti->val.array.columns; j++) { T value; operToScalar(value, xMulti->val.array.lparray[i * xMulti->val.array.columns + j]); row.push_back(value); } ret.push_back(row); } if (needToFree) Excel(xlFree, 0, 1, &xTemp); return ret; } catch (const std::exception &e) { if (needToFree) Excel(xlFree, 0, 1, &xTemp); std::ostringstream msg; msg << "operToMatrix: " << e.what(); throw Exception(msg.str()); } } template <class T> std::vector<std::vector<T> > fpToMatrix(const FP &fpMatrix) { std::vector<std::vector<T> > ret; for (int i=0; i<fpMatrix.rows; i++) { std::vector<T> row; for (int j=0; j<fpMatrix.columns; j++) row.push_back(fpMatrix.array[i * fpMatrix.columns + j]); ret.push_back(row); } return ret; } } #endif --- NEW FILE: opertoscalar.cpp --- /* Copyright (C) 2005 Plamen Neykov Copyright (C) 2004, 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #include <ohxl/Conversions/opertoscalar.hpp> #include <oh/exception.hpp> #include <oh/utilities.hpp> #include <sstream> namespace ObjHandler { DLL_API void operToScalar(long &ret, const OPER &xScalar, const long &defaultValue) { try { //if (xScalar.xltype & xltypeErr) // throw Exception("input value is #NULL (xltypeErr)"); //if (xScalar.xltype & (xltypeMissing | xltypeNil)) if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) ret = defaultValue; else if (xScalar.xltype == xltypeNum) ret = xScalar.val.num; else { OPER xLong; Excel(xlCoerce, &xLong, 2, &xScalar, TempInt(xltypeInt)); ret = xLong.val.w; } } catch (const std::exception &e) { std::ostringstream msg; msg << "operToScalar cannot coerce to long: " << e.what(); throw Exception(msg.str()); } } DLL_API void operToScalar(double &ret, const OPER &xScalar, const double &defaultValue) { try { //if (xScalar.xltype & xltypeErr) // throw Exception("input value is #NULL (xltypeErr)"); //if (xScalar.xltype & (xltypeMissing | xltypeNil)) if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) ret = defaultValue; else if (xScalar.xltype == xltypeNum) ret = xScalar.val.num; else { OPER xDouble; Excel(xlCoerce, &xDouble, 2, &xScalar, TempInt(xltypeNum)); ret = xDouble.val.num; } } catch (const std::exception &e) { std::ostringstream msg; msg << "operToScalar cannot coerce to double: " << e.what(); throw Exception(msg.str()); } } DLL_API void operToScalar(bool &ret, const OPER &xScalar, const bool &defaultValue) { try { //if (xScalar.xltype & xltypeErr) // throw Exception("input value is #NULL (xltypeErr)"); //if (xScalar.xltype & (xltypeMissing | xltypeNil)) if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) ret = defaultValue; else if (xScalar.xltype == xltypeBool) ret = xScalar.val.boolean != 0; else { OPER xBool; Excel(xlCoerce, &xBool, 2, &xScalar, TempInt(xltypeBool)); ret = xBool.val.boolean != 0; } } catch (const std::exception &e) { std::ostringstream msg; msg << "operToScalar cannot coerce to bool: " << e.what(); throw Exception(msg.str()); } } DLL_API void operToScalar(std::string &ret, const OPER &xScalar, const std::string &defaultValue) { OPER xTemp; bool needToFree = false; try { //if (xScalar.xltype & xltypeErr) // throw Exception("input value is #NULL (xltypeErr)"); //if (xScalar.xltype & (xltypeMissing | xltypeNil)) if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) { ret = defaultValue; return; } const OPER *xString; if (xScalar.xltype == xltypeStr) xString = &xScalar; else { Excel(xlCoerce, &xTemp, 2, &xScalar, TempInt(xltypeStr)); xString = &xTemp; needToFree = true; } //if (xString->val.str[0]) // ret.assign(xString->val.str + 1, xString->val.str[0]); // expirimental workaround for apparent bug in Excel API // where the value for the string length wraps around the byte int stringLength = xString->val.str[0]; if (stringLength < 0) stringLength += 257; if (stringLength) ret.assign(xString->val.str + 1, stringLength); if (needToFree) Excel(xlFree, 0, 1, &xTemp); } catch (const std::exception &e) { if (needToFree) Excel(xlFree, 0, 1, &xTemp); std::ostringstream msg; msg << "operToScalar cannot coerce to string: " << e.what(); throw Exception(msg.str()); } } DLL_API void operToScalar(boost::any &ret, const OPER &xScalar) { //if (xScalar.xltype & xltypeErr) // throw Exception("input value is #NULL (xltypeErr)"); //if (xScalar.xltype & (xltypeMissing | xltypeNil)) if (xScalar.xltype & (xltypeMissing | xltypeNil | xltypeErr)) ret = boost::any(); //else if (xScalar.xltype & xltypeErr) // ret = InvalidInput; else if (xScalar.xltype == xltypeNum) ret = xScalar.val.num; else if (xScalar.xltype == xltypeBool) ret = xScalar.val.boolean != 0; else if (xScalar.xltype == xltypeStr) { std::string value; operToScalar(value, xScalar); ret = value; } else throw Exception("operToScalar cannot coerce to boost::any: unexpected datatype"); } void operToOper(OPER *xTarget, const OPER *xSource) { if (xSource->xltype == xltypeNum) { xTarget->xltype = xltypeNum; xTarget->val.num = xSource->val.num; return; } else if (xSource->xltype == xltypeStr) { int len = xSource->val.str[0]; xTarget->val.str = new char[ len + 1 ]; if (!xTarget->val.str) throw Exception("operToOper: error calling new"); xTarget->xltype = xltypeStr | xlbitDLLFree; xTarget->val.str[0] = len; if (len) strncpy(xTarget->val.str + 1, xSource->val.str + 1, len); return; } else if (xSource->xltype == xltypeErr) { xTarget->xltype = xltypeErr; xTarget->val.err = xSource->val.err; return; } else if (xSource->xltype == xltypeNil) { xTarget->xltype = xltypeNil; return; } else { std::ostringstream msg; msg << "operToOper: unexpected OPER type: " << xSource->xltype; throw Exception(msg.str()); } } } --- NEW FILE: matrixtooper.hpp --- /* Copyright (C) 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #ifndef ohxl_conversions_matrixtooper_hpp #define ohxl_conversions_matrixtooper_hpp #include <ohxl/Conversions/scalartooper.hpp> #include <vector> namespace ObjHandler { template <class T> void matrixToXloper(XLOPER &xMatrix, const std::vector<std::vector<T> > &vv) { if (vv.empty() || vv[0].empty()) { //xMatrix.xltype = xltypeNum; //xMatrix.val.num = 0; xMatrix.xltype = xltypeErr; xMatrix.val.err = xlerrNA; return; } xMatrix.val.array.rows = vv.size(); xMatrix.val.array.columns = vv[0].size(); xMatrix.val.array.lparray = new XLOPER[xMatrix.val.array.rows * xMatrix.val.array.columns]; if (!xMatrix.val.array.lparray) throw Exception("matrixToXloper: error on call to new"); xMatrix.xltype = xltypeMulti | xlbitDLLFree; for (unsigned int i=0; i<vv.size(); i++) { std::vector<T> v = vv[i]; for (unsigned int j=0; j<v.size(); j++) scalarToXloper(xMatrix.val.array.lparray[i * v.size() + j], v[j]); } } } #endif --- NEW FILE: opertoscalar.hpp --- /* Copyright (C) 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #ifndef ohxl_conversions_opertoscalar_hpp #define ohxl_conversions_opertoscalar_hpp #include <oh/objhandlerdefines.hpp> #include <xlsdk/xlsdkdefines.hpp> #include <string> #include <boost/any.hpp> namespace ObjHandler { DLL_API void operToScalar(long &ret, const OPER &xScalar, const long &defaultValue = 0); DLL_API void operToScalar(double &ret, const OPER &xScalar, const double &defaultValue = 0.); DLL_API void operToScalar(bool &ret, const OPER &xScalar, const bool &defaultValue = false); DLL_API void operToScalar(std::string &ret, const OPER &xScalar, const std::string &defaultValue = ""); DLL_API void operToScalar(boost::any &ret, const OPER &xScalar); void operToOper(OPER *xTarget, const OPER *xSource); } #endif --- NEW FILE: vectortooper.hpp --- /* Copyright (C) 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #ifndef ohxl_conversions_vectortooper_hpp #define ohxl_conversions_vectortooper_hpp #include <ohxl/Conversions/scalartooper.hpp> #include <ohxl/functioncall.hpp> #include <vector> namespace ObjHandler { template <class T> void vectorToXloper(XLOPER &xVector, const std::vector<T> &v) { if (v.empty()) { //xVector.xltype = xltypeNum; //xVector.val.num = 0; xVector.xltype = xltypeErr; xVector.val.err = xlerrNA; return; } if (FunctionCall::instance().getCallerDimensions() == Row) { xVector.val.array.columns = v.size(); xVector.val.array.rows = 1; } else { xVector.val.array.rows = v.size(); xVector.val.array.columns = 1; } xVector.val.array.lparray = new XLOPER[v.size()]; if (!xVector.val.array.lparray) throw Exception("vectorToXloper: error on call to new"); xVector.xltype = xltypeMulti | xlbitDLLFree; for (unsigned int i=0; i<v.size(); i++) scalarToXloper(xVector.val.array.lparray[i], v[i]); } } #endif --- NEW FILE: scalartooper.cpp --- /* Copyright (C) 2005 Plamen Neykov Copyright (C) 2004, 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #include <ohxl/Conversions/scalartooper.hpp> #include <ohxl/Conversions/vectortooper.hpp> #include <ohxl/Conversions/matrixtooper.hpp> #include <oh/exception.hpp> #include <oh/utilities.hpp> #include <sstream> namespace ObjHandler { DLL_API void scalarToXloper(XLOPER &xLong, const long &value) { xLong.xltype = xltypeNum; xLong.val.num = value; } DLL_API void scalarToXloper(XLOPER &xDouble, const double &value) { xDouble.xltype = xltypeNum; xDouble.val.num = value; } DLL_API void scalarToXloper(XLOPER &xBoolean, const bool &value) { xBoolean.xltype = xltypeBool; xBoolean.val.boolean = value; } DLL_API void scalarToXloper(XLOPER &xString, const std::string &value) { int len = __min(XL_MAX_STR_LEN, value.length()); xString.val.str = new char[ len + 1 ]; if (!xString.val.str) throw Exception("stringToXloper: error calling new"); xString.xltype = xltypeStr | xlbitDLLFree; xString.val.str[0] = len; if (len) strncpy(xString.val.str + 1, value.c_str(), len); } DLL_API void scalarToXloper( XLOPER &xAny, const boost::any &value, const bool &expandVectors) { if (value.type() == typeid(XLOPER)) { XLOPER xTemp = boost::any_cast<XLOPER>(value); Excel(xlCoerce, &xAny, 1, &xTemp); } else if (value.type() == typeid(XLOPER*)) { XLOPER *xTemp = boost::any_cast<XLOPER*>(value); Excel(xlCoerce, &xAny, 1, xTemp); } else if (value.type() == typeid(int)) { xAny.xltype = xltypeNum; xAny.val.num = boost::any_cast<int>(value); } else if (value.type() == typeid(long)) { xAny.xltype = xltypeNum; xAny.val.num = boost::any_cast<long>(value); } else if (value.type() == typeid(double)) { xAny.xltype = xltypeNum; xAny.val.num = boost::any_cast<double>(value); } else if (value.type() == typeid(bool)) { xAny.xltype = xltypeBool; xAny.val.boolean = boost::any_cast<bool>(value); } else if (value.type() == typeid(std::string)) { std::string s = boost::any_cast<std::string>(value); scalarToXloper(xAny, s); } else if (value.type() == typeid(std::vector<long>)) { if (expandVectors) { std::vector<long> v= boost::any_cast< std::vector<long> >(value); vectorToXloper(xAny, v); } else { scalarToXloper(xAny, std::string(VECTOR)); } } else if (value.type() == typeid(std::vector<double>)) { if (expandVectors) { std::vector<double> v= boost::any_cast< std::vector<double> >(value); vectorToXloper(xAny, v); } else { scalarToXloper(xAny, std::string(VECTOR)); } } else if (value.type() == typeid(std::vector<bool>)) { if (expandVectors) { std::vector<bool> v= boost::any_cast< std::vector<bool> >(value); vectorToXloper(xAny, v); } else { scalarToXloper(xAny, std::string(VECTOR)); } } else if (value.type() == typeid(std::vector< std::string >)) { if (expandVectors) { std::vector< std::string > v= boost::any_cast< std::vector< std::string > >(value); vectorToXloper(xAny, v); } else { scalarToXloper(xAny, std::string(VECTOR)); } } else if (value.type() == typeid(std::vector< boost::any >)) { if (expandVectors) { std::vector< boost::any > v= boost::any_cast< std::vector< boost::any > >(value); vectorToXloper(xAny, v); } else { scalarToXloper(xAny, std::string(VECTOR)); } } else if (value.type() == typeid(std::vector< std::vector< long > >)) { if (expandVectors) { std::vector< std::vector<long> >vv = boost::any_cast< std::vector< std::vector<long> > >(value); vectorToXloper(xAny, vv); } else { scalarToXloper(xAny, std::string(MATRIX)); } } else if (value.type() == typeid(std::vector< std::vector< double > >)) { if (expandVectors) { std::vector< std::vector< double > >vv = boost::any_cast< std::vector< std::vector< double > > >(value); matrixToXloper(xAny, vv); } else { scalarToXloper(xAny, std::string(MATRIX)); } } else if (value.type() == typeid(std::vector< std::vector< bool > >)) { if (expandVectors) { std::vector< std::vector< bool > >vv = boost::any_cast< std::vector< std::vector< bool > > >(value); // FIXME VC8 compilation fails on this line // support for matrix of bools not presently required //matrixToXloper(xAny, vv); } else { scalarToXloper(xAny, std::string(MATRIX)); } } else if (value.type() == typeid(std::vector< std::vector< std::string > >)) { if (expandVectors) { std::vector< std::vector< std::string > >vv = boost::any_cast< std::vector< std::vector< std::string > > >(value); matrixToXloper(xAny, vv); } else { scalarToXloper(xAny, std::string(MATRIX)); } } else if (value.type() == typeid(std::vector< std::vector< boost::any > >)) { if (expandVectors) { std::vector< std::vector< boost::any > >vv = boost::any_cast< std::vector< std::vector< boost::any > > >(value); matrixToXloper(xAny, vv); } else { scalarToXloper(xAny, std::string(MATRIX)); } } else { xAny.xltype = xltypeErr; xAny.val.err = xlerrValue; } } } --- NEW FILE: opertovector.hpp --- /* Copyright (C) 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #ifndef ohxl_conversions_opertovector_hpp #define ohxl_conversions_opertovector_hpp #include <ohxl/Conversions/opertoscalar.hpp> #include <vector> namespace ObjHandler { template <class T> std::vector<T> operToVector(const OPER &xVector) { OPER xTemp; bool needToFree = false; try { std::vector<T> ret; if (xVector.xltype & xltypeErr) throw Exception("input value is #NULL (xltypeErr)"); if (xVector.xltype & (xltypeMissing | xltypeNil)) return ret; const OPER *xMulti; if (xVector.xltype == xltypeMulti) xMulti = &xVector; else { Excel(xlCoerce, &xTemp, 2, &xVector, TempInt(xltypeMulti)); xMulti = &xTemp; needToFree = true; } for (int i=0; i<xMulti->val.array.rows * xMulti->val.array.columns; i++) { T value; operToScalar(value, xMulti->val.array.lparray[i]); ret.push_back(value); } if (needToFree) Excel(xlFree, 0, 1, &xTemp); return ret; } catch (const std::exception &e) { if (needToFree) Excel(xlFree, 0, 1, &xTemp); std::ostringstream msg; msg << "operToVector: " << e.what(); throw Exception(msg.str()); } } template <class T> std::vector<T> fpToVector(const FP &fpVector) { std::vector<T> ret; for (int i=0; i<fpVector.rows * fpVector.columns; i++) ret.push_back(fpVector.array[i]); return ret; } } #endif --- NEW FILE: validations.hpp --- /* Copyright (C) 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #ifndef ohxl_conversions_validations_hpp #define ohxl_conversions_validations_hpp #include <oh/objhandlerdefines.hpp> #include <xlsdk/xlsdkdefines.hpp> #include <ohxl/functioncall.hpp> #include <vector> #include <string> #include <boost/any.hpp> namespace ObjHandler { DLL_API void validateRange(const OPER *xRange, const std::string &name); DLL_API void validateReference(const XLOPER *xReference, const std::string &name); DLL_API void stringToChar(char *c, const std::string &s); void operToOper(OPER *xTarget, const OPER *xSource); } #endif --- NEW FILE: validations.cpp --- /* Copyright (C) 2005 Plamen Neykov Copyright (C) 2004, 2005, 2006 Eric Ehlers This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email qua...@li... The license is also available online at http://quantlib.org/html/license.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ #include <ohxl/Conversions/validations.hpp> #include <oh/exception.hpp> #include <sstream> namespace ObjHandler { bool validateMulti(const OPER *xMulti) { for (int i=0; i<xMulti->val.array.rows * xMulti->val.array.columns; i++) if (xMulti->val.array.lparray[i].xltype == xltypeErr) return false; return true; } DLL_API void validateRange(const OPER *xRange, const std::string &name) { if (xRange->xltype == xltypeErr) { std::ostringstream msg; msg << "parameter '" << name << "' has error value"; throw Exception(msg.str()); } else if (xRange->xltype == xltypeMulti) { if (!validateMulti(xRange)) { std::ostringstream msg; msg << "parameter '" << name << "' has error value"; throw Exception(msg.str()); } } } DLL_API void validateReference(const XLOPER *xReference, const std::string &name) { if (xReference->xltype != xltypeMissing && xReference->xltype != xltypeRef && xReference->xltype != xltypeSRef) { std::ostringstream msg; msg << "parameter '" << name << "' is not a valid range reference"; throw Exception(msg.str()); } } DLL_API void stringToChar(char *c, const std::string &value) { int len = __min(XL_MAX_STR_LEN, value.length()); strncpy(c, value.c_str(), len); c[len] = 0; } } |
From: Eric E. <eri...@us...> - 2006-11-16 12:38:43
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/ohxllib In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17350/ohxl/ohxllib Modified Files: ohxllib.vcproj ohxllib_vc8.vcproj Log Message: consolidate conversion functions in preparation for implementation of coercion Index: ohxllib_vc8.vcproj =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/ohxllib/ohxllib_vc8.vcproj,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ohxllib_vc8.vcproj 18 Oct 2006 13:01:29 -0000 1.14 --- ohxllib_vc8.vcproj 16 Nov 2006 12:38:41 -0000 1.15 *************** *** 389,464 **** Name="xl" > ! <File ! RelativePath="..\callingrange.cpp" ! > ! </File> ! <File ! RelativePath="..\callingrange.hpp" ! > ! </File> ! <File ! RelativePath="..\conversions.cpp" ! > ! </File> ! <File ! RelativePath="..\conversions.hpp" ! > ! </File> ! <File ! RelativePath="..\export.hpp" ! > ! </File> ! <File ! RelativePath="..\functioncall.cpp" ! > ! </File> ! <File ! RelativePath="..\functioncall.hpp" ! > ! </File> ! <File ! RelativePath="..\Functions\functioncount.hpp" ! > ! </File> ! <File ! RelativePath="..\Functions\functions.cpp" ! > ! </File> ! <File ! RelativePath="..\Functions\manual.cpp" ! > ! </File> ! <File ! RelativePath="..\objecthandlerxl.cpp" ! > ! </File> ! <File ! RelativePath="..\objecthandlerxl.hpp" ! > ! </File> ! <File ! RelativePath="..\objhandlerxl.hpp" ! > ! </File> ! <File ! RelativePath="..\rangereference.cpp" ! > ! </File> ! <File ! RelativePath="..\rangereference.hpp" > ! </File> ! <File ! RelativePath="..\Register\register_all.cpp" > ! </File> ! <File ! RelativePath="..\Register\register_all.hpp" > ! </File> ! <File ! RelativePath="..\Register\register_functions.cpp" > ! </File> </Filter> </Files> --- 389,516 ---- Name="xl" > ! <Filter ! Name="Conversions" > ! <File ! RelativePath="..\Conversions\all.hpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\matrixtooper.hpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\opertomatrix.hpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\opertoscalar.cpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\opertoscalar.hpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\opertovector.hpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\scalartooper.cpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\scalartooper.hpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\validations.cpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\validations.hpp" ! > ! </File> ! <File ! RelativePath="..\Conversions\vectortooper.hpp" ! > ! </File> ! </Filter> ! <Filter ! Name="Functions" > ! <File ! RelativePath="..\Functions\export.hpp" ! > ! </File> ! <File ! RelativePath="..\Functions\functioncount.hpp" ! > ! </File> ! <File ! RelativePath="..\Functions\functions.cpp" ! > ! </File> ! <File ! RelativePath="..\Functions\manual.cpp" ! > ! </File> ! </Filter> ! <Filter ! Name="Register" > ! <File ! RelativePath="..\Register\register_all.cpp" ! > ! </File> ! <File ! RelativePath="..\Register\register_all.hpp" ! > ! </File> ! <File ! RelativePath="..\Register\register_functions.cpp" ! > ! </File> ! </Filter> ! <Filter ! Name="Classes" > ! <File ! RelativePath="..\callingrange.cpp" ! > ! </File> ! <File ! RelativePath="..\callingrange.hpp" ! > ! </File> ! <File ! RelativePath="..\functioncall.cpp" ! > ! </File> ! <File ! RelativePath="..\functioncall.hpp" ! > ! </File> ! <File ! RelativePath="..\objecthandlerxl.cpp" ! > ! </File> ! <File ! RelativePath="..\objecthandlerxl.hpp" ! > ! </File> ! <File ! RelativePath="..\objhandlerxl.hpp" ! > ! </File> ! <File ! RelativePath="..\rangereference.cpp" ! > ! </File> ! <File ! RelativePath="..\rangereference.hpp" ! > ! </File> ! </Filter> </Filter> </Files> Index: ohxllib.vcproj =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/ohxllib/ohxllib.vcproj,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ohxllib.vcproj 18 Oct 2006 13:01:29 -0000 1.12 --- ohxllib.vcproj 16 Nov 2006 12:38:41 -0000 1.13 *************** *** 383,440 **** Name="xl" Filter=""> ! <File ! RelativePath="..\callingrange.cpp"> ! </File> ! <File ! RelativePath="..\callingrange.hpp"> ! </File> ! <File ! RelativePath="..\conversions.cpp"> ! </File> ! <File ! RelativePath="..\conversions.hpp"> ! </File> ! <File ! RelativePath="..\export.hpp"> ! </File> ! <File ! RelativePath="..\functioncall.cpp"> ! </File> ! <File ! RelativePath="..\functioncall.hpp"> ! </File> ! <File ! RelativePath="..\Functions\functioncount.hpp"> ! </File> ! <File ! RelativePath="..\Functions\functions.cpp"> ! </File> ! <File ! RelativePath="..\Functions\manual.cpp"> ! </File> ! <File ! RelativePath="..\objecthandlerxl.cpp"> ! </File> ! <File ! RelativePath="..\objecthandlerxl.hpp"> ! </File> ! <File ! RelativePath="..\objhandlerxl.hpp"> ! </File> ! <File ! RelativePath="..\rangereference.cpp"> ! </File> ! <File ! RelativePath="..\rangereference.hpp"> ! </File> ! <File ! RelativePath="..\Register\register_all.cpp"> ! </File> ! <File ! RelativePath="..\Register\register_all.hpp"> ! </File> ! <File ! RelativePath="..\Register\register_functions.cpp"> ! </File> </Filter> </Files> --- 383,483 ---- Name="xl" Filter=""> ! <Filter ! Name="Conversions" ! Filter=""> ! <File ! RelativePath="..\Conversions\all.hpp"> ! </File> ! <File ! RelativePath="..\Conversions\matrixtooper.hpp"> ! </File> ! <File ! RelativePath="..\Conversions\opertomatrix.hpp"> ! </File> ! <File ! RelativePath="..\Conversions\opertoscalar.cpp"> ! </File> ! <File ! RelativePath="..\Conversions\opertoscalar.hpp"> ! </File> ! <File ! RelativePath="..\Conversions\opertovector.hpp"> ! </File> ! <File ! RelativePath="..\Conversions\scalartooper.cpp"> ! </File> ! <File ! RelativePath="..\Conversions\scalartooper.hpp"> ! </File> ! <File ! RelativePath="..\Conversions\validations.cpp"> ! </File> ! <File ! RelativePath="..\Conversions\validations.hpp"> ! </File> ! <File ! RelativePath="..\Conversions\vectortooper.hpp"> ! </File> ! </Filter> ! <Filter ! Name="Functions" ! Filter=""> ! <File ! RelativePath="..\Functions\export.hpp"> ! </File> ! <File ! RelativePath="..\Functions\functioncount.hpp"> ! </File> ! <File ! RelativePath="..\Functions\functions.cpp"> ! </File> ! <File ! RelativePath="..\Functions\manual.cpp"> ! </File> ! </Filter> ! <Filter ! Name="Classes" ! Filter=""> ! <File ! RelativePath="..\callingrange.cpp"> ! </File> ! <File ! RelativePath="..\callingrange.hpp"> ! </File> ! <File ! RelativePath="..\functioncall.cpp"> ! </File> ! <File ! RelativePath="..\functioncall.hpp"> ! </File> ! <File ! RelativePath="..\objecthandlerxl.cpp"> ! </File> ! <File ! RelativePath="..\objecthandlerxl.hpp"> ! </File> ! <File ! RelativePath="..\objhandlerxl.hpp"> ! </File> ! <File ! RelativePath="..\rangereference.cpp"> ! </File> ! <File ! RelativePath="..\rangereference.hpp"> ! </File> ! </Filter> ! <Filter ! Name="Register" ! Filter=""> ! <File ! RelativePath="..\Register\register_all.cpp"> ! </File> ! <File ! RelativePath="..\Register\register_all.hpp"> ! </File> ! <File ! RelativePath="..\Register\register_functions.cpp"> ! </File> ! </Filter> </Filter> </Files> |
Update of /cvsroot/objecthandler/ObjectHandler/ohxl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17350/ohxl Modified Files: .cvsignore callingrange.cpp functioncall.cpp objecthandlerxl.cpp objhandlerxl.hpp Removed Files: conversions.cpp conversions.hpp Log Message: consolidate conversion functions in preparation for implementation of coercion Index: .cvsignore =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/.cvsignore,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** .cvsignore 18 Oct 2006 13:01:26 -0000 1.5 --- .cvsignore 16 Nov 2006 12:38:40 -0000 1.6 *************** *** 1,3 **** Makefile Makefile.in - export.hpp --- 1,2 ---- Index: objecthandlerxl.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/objecthandlerxl.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** objecthandlerxl.cpp 30 Oct 2006 16:21:40 -0000 1.21 --- objecthandlerxl.cpp 16 Nov 2006 12:38:40 -0000 1.22 *************** *** 20,24 **** #include <ohxl/objecthandlerxl.hpp> #include <ohxl/callingrange.hpp> ! #include <ohxl/conversions.hpp> #include <ohxl/functioncall.hpp> /* Use BOOST_MSVC instead of _MSC_VER since some other vendors (Metrowerks, --- 20,24 ---- #include <ohxl/objecthandlerxl.hpp> #include <ohxl/callingrange.hpp> ! #include <ohxl/Conversions/opertoscalar.hpp> #include <ohxl/functioncall.hpp> /* Use BOOST_MSVC instead of _MSC_VER since some other vendors (Metrowerks, --- conversions.hpp DELETED --- Index: functioncall.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/functioncall.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** functioncall.cpp 30 Oct 2006 15:46:51 -0000 1.11 --- functioncall.cpp 16 Nov 2006 12:38:40 -0000 1.12 *************** *** 20,24 **** #include <oh/exception.hpp> #include <ohxl/functioncall.hpp> ! #include <ohxl/conversions.hpp> #include <sstream> #include <string> --- 20,24 ---- #include <oh/exception.hpp> #include <ohxl/functioncall.hpp> ! #include <ohxl/Conversions/opertoscalar.hpp> #include <sstream> #include <string> --- conversions.cpp DELETED --- Index: callingrange.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/callingrange.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** callingrange.cpp 4 Oct 2006 09:37:43 -0000 1.11 --- callingrange.cpp 16 Nov 2006 12:38:40 -0000 1.12 *************** *** 17,21 **** #include <ohxl/callingrange.hpp> ! #include <ohxl/conversions.hpp> #include <ohxl/functioncall.hpp> #include <oh/objecthandler.hpp> --- 17,21 ---- #include <ohxl/callingrange.hpp> ! #include <ohxl/Conversions/opertoscalar.hpp> #include <ohxl/functioncall.hpp> #include <oh/objecthandler.hpp> Index: objhandlerxl.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/objhandlerxl.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** objhandlerxl.hpp 11 Jun 2006 12:38:22 -0000 1.1 --- objhandlerxl.hpp 16 Nov 2006 12:38:40 -0000 1.2 *************** *** 21,25 **** #include <oh/objhandler.hpp> #include <ohxl/objecthandlerxl.hpp> ! #include <ohxl/conversions.hpp> #include <ohxl/functioncall.hpp> #include <ohxl/callingrange.hpp> --- 21,25 ---- #include <oh/objhandler.hpp> #include <ohxl/objecthandlerxl.hpp> ! #include <ohxl/Conversions/all.hpp> #include <ohxl/functioncall.hpp> #include <ohxl/callingrange.hpp> |
From: Eric E. <eri...@us...> - 2006-11-16 12:38:43
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Functions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17350/ohxl/Functions Modified Files: .cvsignore manual.cpp Log Message: consolidate conversion functions in preparation for implementation of coercion Index: .cvsignore =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Functions/.cvsignore,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .cvsignore 18 Oct 2006 13:01:29 -0000 1.3 --- .cvsignore 16 Nov 2006 12:38:41 -0000 1.4 *************** *** 1,2 **** --- 1,3 ---- functions.cpp functioncount.hpp + export.hpp \ No newline at end of file Index: manual.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Functions/manual.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** manual.cpp 30 Oct 2006 18:39:18 -0000 1.6 --- manual.cpp 16 Nov 2006 12:38:41 -0000 1.7 *************** *** 22,26 **** #include <oh/exception.hpp> #include <ohxl/objecthandlerxl.hpp> ! #include <ohxl/conversions.hpp> #include <ohxl/functioncall.hpp> #include <ohxl/Functions/functioncount.hpp> --- 22,26 ---- #include <oh/exception.hpp> #include <ohxl/objecthandlerxl.hpp> ! #include <ohxl/Conversions/all.hpp> #include <ohxl/functioncall.hpp> #include <ohxl/Functions/functioncount.hpp> |
From: Eric E. <eri...@us...> - 2006-11-16 12:27:53
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12848/Conversions Log Message: Directory /cvsroot/objecthandler/ObjectHandler/ohxl/Conversions added to the repository |
From: Eric E. <eri...@us...> - 2006-10-30 18:39:26
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28265/ohxl Modified Files: conversions.cpp conversions.hpp Log Message: ohDependsOn() - validate only that inputs are valid range references Index: conversions.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/conversions.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** conversions.cpp 29 Oct 2006 14:11:38 -0000 1.11 --- conversions.cpp 30 Oct 2006 18:39:18 -0000 1.12 *************** *** 31,55 **** } ! DLL_API void validateReference(const OPER *xReference, const std::string &name) { ! if (xReference->xltype == xltypeErr) { std::ostringstream msg; msg << "parameter '" << name << "' has error value"; throw Exception(msg.str()); ! } else if (xReference->xltype == xltypeMulti) { ! if (!validateMulti(xReference)) { std::ostringstream msg; msg << "parameter '" << name << "' has error value"; throw Exception(msg.str()); } ! //} else if (xReference->xltype == xltypeRef || xReference->xltype == xltypeSRef) { ! // XLOPER xMulti; ! // Excel(xlCoerce, &xMulti, 1, xReference, TempInt(xltypeMulti)); ! // bool isValid = validateMulti(&xMulti); ! // Excel(xlFree, 0, 1, &xMulti); ! // if (!isValid) { ! // std::ostringstream msg; ! // msg << "parameter '" << name << "' has error value"; ! // throw Exception(msg.str()); ! // } } } --- 31,55 ---- } ! DLL_API void validateRange(const OPER *xRange, const std::string &name) { ! if (xRange->xltype == xltypeErr) { std::ostringstream msg; msg << "parameter '" << name << "' has error value"; throw Exception(msg.str()); ! } else if (xRange->xltype == xltypeMulti) { ! if (!validateMulti(xRange)) { std::ostringstream msg; msg << "parameter '" << name << "' has error value"; throw Exception(msg.str()); } ! } ! } ! ! DLL_API void validateReference(const XLOPER *xReference, const std::string &name) { ! if (xReference->xltype != xltypeMissing ! && xReference->xltype != xltypeRef ! && xReference->xltype != xltypeSRef) { ! std::ostringstream msg; ! msg << "parameter '" << name << "' is not a valid range reference"; ! throw Exception(msg.str()); } } Index: conversions.hpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/conversions.hpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** conversions.hpp 29 Oct 2006 14:11:38 -0000 1.12 --- conversions.hpp 30 Oct 2006 18:39:18 -0000 1.13 *************** *** 28,32 **** namespace ObjHandler { ! DLL_API void validateReference(const OPER *xReference, const std::string &name); DLL_API void stringToChar(char *c, const std::string &s); void operToOper(OPER *xTarget, const OPER *xSource); --- 28,33 ---- namespace ObjHandler { ! DLL_API void validateRange(const OPER *xRange, const std::string &name); ! DLL_API void validateReference(const XLOPER *xReference, const std::string &name); DLL_API void stringToChar(char *c, const std::string &s); void operToOper(OPER *xTarget, const OPER *xSource); |
From: Eric E. <eri...@us...> - 2006-10-30 18:39:26
|
Update of /cvsroot/objecthandler/ObjectHandler/ohxl/Functions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28265/ohxl/Functions Modified Files: manual.cpp Log Message: ohDependsOn() - validate only that inputs are valid range references Index: manual.cpp =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/ohxl/Functions/manual.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** manual.cpp 30 Oct 2006 12:58:23 -0000 1.5 --- manual.cpp 30 Oct 2006 18:39:18 -0000 1.6 *************** *** 33,46 **** XLL_DEC long *ohDependsOn( ! OPER *dummy0, ! OPER *dummy1, ! OPER *dummy2, ! OPER *dummy3, ! OPER *dummy4, ! OPER *dummy5, ! OPER *dummy6, ! OPER *dummy7, ! OPER *dummy8, ! OPER *dummy9) { boost::shared_ptr<ObjHandler::FunctionCall> functionCall; try { --- 33,46 ---- XLL_DEC long *ohDependsOn( ! XLOPER *dummy0, ! XLOPER *dummy1, ! XLOPER *dummy2, ! XLOPER *dummy3, ! XLOPER *dummy4, ! XLOPER *dummy5, ! XLOPER *dummy6, ! XLOPER *dummy7, ! XLOPER *dummy8, ! XLOPER *dummy9) { boost::shared_ptr<ObjHandler::FunctionCall> functionCall; try { *************** *** 82,90 **** } catch (const std::exception &e) { ! std::ostringstream err; ! err << "ohDependsOn - "; ! if (functionCall) err << functionCall->getAddressString() << " - "; ! err << e.what(); ! ObjHandler::ObjectHandlerXL::instance().logError(err.str()); return 0; } --- 82,86 ---- } catch (const std::exception &e) { ! ObjHandler::ObjectHandlerXL::instance().logError(e.what()); return 0; } *************** *** 168,176 **** // log the exception and return a null pointer (#NUM!) to Excel ! std::ostringstream err; ! err << "ohPack - "; ! if (functionCall) err << functionCall->getAddressString() << " - "; ! err << e.what(); ! ObjHandler::logMessage(err.str(), 2); return 0; } --- 164,168 ---- // log the exception and return a null pointer (#NUM!) to Excel ! ObjHandler::ObjectHandlerXL::instance().logError(e.what()); return 0; } *************** *** 249,257 **** } catch (const std::exception &e) { ! std::ostringstream err; ! err << "ohParseField - "; ! if (functionCall) err << functionCall->getAddressString() << " - "; ! err << e.what(); ! ObjHandler::logMessage(err.str(), 2); return 0; } --- 241,245 ---- } catch (const std::exception &e) { ! ObjHandler::ObjectHandlerXL::instance().logError(e.what()); return 0; } |
From: Eric E. <eri...@us...> - 2006-10-30 18:39:23
|
Update of /cvsroot/objecthandler/ObjectHandler/gensrc/metadata In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28265/gensrc/metadata Modified Files: functions.xml Log Message: ohDependsOn() - validate only that inputs are valid range references Index: functions.xml =================================================================== RCS file: /cvsroot/objecthandler/ObjectHandler/gensrc/metadata/functions.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** functions.xml 29 Oct 2006 14:11:37 -0000 1.25 --- functions.xml 30 Oct 2006 18:39:18 -0000 1.26 *************** *** 85,136 **** <Parameters> <Parameter name='dummy0' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> <Parameter name='dummy1' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> <Parameter name='dummy2' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> <Parameter name='dummy3' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> <Parameter name='dummy4' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> <Parameter name='dummy5' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> <Parameter name='dummy6' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> <Parameter name='dummy7' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> <Parameter name='dummy8' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> <Parameter name='dummy9' ignore='true'> ! <type>any</type> <tensorRank>scalar</tensorRank> ! <description>dummy parameter (ignored)</description> </Parameter> </Parameters> --- 85,136 ---- <Parameters> <Parameter name='dummy0' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> <Parameter name='dummy1' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> <Parameter name='dummy2' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> <Parameter name='dummy3' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> <Parameter name='dummy4' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> <Parameter name='dummy5' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> <Parameter name='dummy6' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> <Parameter name='dummy7' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> <Parameter name='dummy8' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> <Parameter name='dummy9' ignore='true'> ! <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>dummy range reference (ignored)</description> </Parameter> </Parameters> *************** *** 359,363 **** <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>range to query (omit to query active range)</description> </Parameter> </Parameters> --- 359,363 ---- <type>reference</type> <tensorRank>scalar</tensorRank> ! <description>range to query</description> </Parameter> </Parameters> |