From: Pat Thoyts Date: Thu, 18 Jun 2009 01:53:26 +0000 (+0100) Subject: Additional support for arrays of doubles X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=bec08422a13b513984f5ca174f21298792e7a4b7;p=tcom Additional support for arrays of doubles Signed-off-by: Pat Thoyts --- diff --git a/src/TclObject.cpp b/src/TclObject.cpp index 3ef5112..39aef5c 100644 --- a/src/TclObject.cpp +++ b/src/TclObject.cpp @@ -213,7 +213,19 @@ convertFromSafeArray ( if (FAILED(hr)) { _com_issue_error(hr); } - + } else if (elementType == VT_R8) { + double *dataPtr = NULL; + Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); + hr = SafeArrayAccessData(psa, reinterpret_cast(&dataPtr)); + if (SUCCEEDED(hr)) { + for (long n = lowerBound; SUCCEEDED(hr) && n <= upperBound; ++n, ++dataPtr) { + Tcl_Obj *eltObj = Tcl_NewDoubleObj(*dataPtr); + Tcl_ListObjAppendElement(interp, listObj, eltObj); + } + SafeArrayUnaccessData(psa); + } + if (FAILED(hr)) _com_issue_error(hr); + pResult = listObj; } else { // Create list of Tcl values. pResult = Tcl_NewListObj(0, 0);