ComObject::eval (TclObject script, TclObject *pResult)
{
int completionCode =
-#if TCL_MINOR_VERSION >= 1
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 81
Tcl_EvalObjEx(m_interp, script, TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL);
#else
Tcl_GlobalEvalObj(m_interp, script);
HRESULT
ComObject::hresultFromErrorCode () const
{
-#if TCL_MINOR_VERSION >= 1
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 81
Tcl_Obj *pErrorCode =
Tcl_GetVar2Ex(m_interp, "::errorCode", 0, TCL_LEAVE_ERR_MSG);
#else
case VT_LPWSTR:
case VT_BSTR:
{
-#if TCL_MINOR_VERSION >= 2
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 82
// Uses Unicode function introduced in Tcl 8.2.
Tcl_UniChar *pUnicode = byRef ?
*va_arg(pArg, Tcl_UniChar **) : va_arg(pArg, Tcl_UniChar *);
ComObjectFactory::eval (TclObject script, TclObject *pResult)
{
int completionCode =
-#if TCL_MINOR_VERSION >= 1
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 81
Tcl_EvalObjEx(m_interp, script, TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL);
#else
Tcl_GlobalEvalObj(m_interp, script);
return TCL_ERROR;
}
- Tcl_ObjType *pType = objv[1]->typePtr;
- char *name = (pType == 0) ? "NULL" : pType->name;
- Tcl_SetResult(interp, name, TCL_STATIC);
+ const Tcl_ObjType *pType = objv[1]->typePtr;
+ const char *name = (pType == 0) ? "NULL" : pType->name;
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1));
return TCL_OK;
}
#define EXTENSION_H
#include <comdef.h>
-#include <tcl.h>
+#include "tclRunTime.h" //<tcl.h>
#include "tcomApi.h"
#include "HandleSupport.h"
#ifndef HANDLESUPPORT_H
#define HANDLESUPPORT_H
-#include <tcl.h>
+#include "tclRunTime.h" //<tcl.h>
#include <string>
#include "tcomApi.h"
#include "Singleton.h"
#ifndef HASHTABLE_H
#define HASHTABLE_H
-#include <tcl.h>
+#include "tclRunTime.h" //<tcl.h>
// Function object that invokes delete on its argument
#ifndef SINGLETON_H
#define SINGLETON_H
-#include <tcl.h>
+#include "tclRunTime.h" //<tcl.h>
#include "mutex.h"
// This template class provides code to construct and destroy a singleton.
#define TCLINTERP_H
#include <string>
-#include <tcl.h>
+#include "tclRunTime.h" //<tcl.h>
+
+
class TclObject;
long length = upperBound - lowerBound + 1;
pResult =
-#if TCL_MINOR_VERSION >= 1
+#if TCL_MAJOR_VERSION * 10 + TCL_MINOR_VERSION >= 81
// Convert array of bytes to Tcl byte array.
Tcl_NewByteArrayObj(pData, length);
#else
TclObject::TclObject (const _bstr_t &src)
{
if (src.length() > 0) {
-#if TCL_MINOR_VERSION >= 2
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION > 81
// Uses Unicode functions introduced in Tcl 8.2.
- m_pObj = Tcl_NewUnicodeObj(src, -1);
+ const wchar_t *wsz = src;
+ m_pObj = Tcl_NewUnicodeObj((const Tcl_UniChar *)wsz, -1);
#else
m_pObj = Tcl_NewStringObj(src, -1);
#endif
case VT_I2:
case VT_UI2:
- static_cast<short *>(pData)[i] = value.getLong();
+ static_cast<short *>(pData)[i] = static_cast<short>(value.getLong());
break;
case VT_R4:
#include "TypeInfo.h"
#include "NativeValue.h"
#endif
-#include <tcl.h>
+#include "tclRunTime.h" //<tcl.h>
#include <string>
#include "tcomApi.h"
static Tcl_ObjType *listType ()
{ return ms_pListType; }
-#if TCL_MINOR_VERSION >= 1
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 81
private:
static Tcl_ObjType *ms_pByteArrayType;
const char *c_str () const
{ return Tcl_GetStringFromObj(const_cast<Tcl_Obj *>(m_pObj), 0); }
-#if TCL_MINOR_VERSION >= 2
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 82
// Construct Unicode string value.
TclObject(const wchar_t *src, int len = -1);
// Execute the script body.
completionCode =
-#if TCL_MINOR_VERSION >= 1
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 81
Tcl_EvalObjEx(interp, pBody, 0);
#else
Tcl_EvalObj(interp, pBody);
break;
} else if (completionCode == TCL_ERROR) {
std::ostringstream oss;
- oss << "\n (\"foreach\" body line %d)" << interp->errorLine;
+ oss << "\n (\"foreach\" body line %d)" << Tcl_GetErrorLine(interp);
Tcl_AddObjErrorInfo(
interp, const_cast<char *>(oss.str().c_str()), -1);
break;
s_pCurrentInterface = pInterface;
int completionCode =
-#if TCL_MINOR_VERSION >= 1
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 81
Tcl_EvalObjEx(interp, objv[3], TCL_EVAL_GLOBAL);
#else
Tcl_GlobalEvalObj(interp, objv[3]);
script << '}' << std::endl; // end of namespace
-#if TCL_MINOR_VERSION >= 1
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 81
Tcl_EvalEx(
interp,
const_cast<char *>(script.str().c_str()),
#include "version.h"
#include "tclRunTime.h"
+#pragma comment(lib, "rpcrt4")
+
/*
* This procedure performs application-specific initialization.
* Most applications, especially those that incorporate additional
extern "C" DLLEXPORT int
Tcom_Init (Tcl_Interp *interp)
{
-#ifdef USE_TCL_STUBS
// Stubs were introduced in Tcl 8.1.
if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
return TCL_ERROR;
}
-#endif
// Get pointers to Tcl's built-in internal representation types.
TclTypes::initialize();
static Tcl_Obj *
formatMessage (HRESULT hresult)
{
-#if TCL_MINOR_VERSION >= 2
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 82
// Uses Unicode functions introduced in Tcl 8.2.
wchar_t *pMessage;
DWORD nLen = FormatMessageW(
pMessage[nLen] = '\0';
-#if TCL_MINOR_VERSION >= 2
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 82
// Uses Unicode functions introduced in Tcl 8.2.
- pDescription = Tcl_NewUnicodeObj(pMessage, nLen);
+ pDescription = Tcl_NewUnicodeObj((const Tcl_UniChar *)pMessage, nLen);
#else
pDescription = Tcl_NewStringObj(pMessage, nLen);
#endif
return TCL_ERROR;
}
-#if TCL_MINOR_VERSION >= 2
- const wchar_t *monikerName = Tcl_GetUnicode(objv[2]);
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION >= 82
+ const wchar_t *monikerName = (const wchar_t *)Tcl_GetUnicode(objv[2]);
#else
_bstr_t monikerName(Tcl_GetStringFromObj(objv[2], 0));
#endif
#include <tcl.h>
+// Tcl API compatability macros
+
+// Tcl 8.6 introduced Tcl_GetErrorLine and removed interp->errorLine
+#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
+#define Tcl_GetErrorLine(interp) (interp)->errorLine
+#define CONST86
+#endif
+
// Link the Tcl run-time library.
#ifdef USE_TCL_STUBS
#pragma comment(lib, \
{
const char *stringRep = Tcl_GetStringFromObj(pObj, 0);
- Tcl_ObjType *pOldType = pObj->typePtr;
+ const Tcl_ObjType *pOldType = pObj->typePtr;
if (pOldType != NULL && pOldType->freeIntRepProc != NULL) {
pOldType->freeIntRepProc(pObj);
}