Skip to content

Commit

Permalink
More stub-related fixes: export TclGetAliasObj and TclGetUnicodeFromO…
Browse files Browse the repository at this point in the history
…bj, for better (binary) compatibility with Tcl 9.0. Remove unneeded '_'
  • Loading branch information
jan.nijtmans committed Jan 4, 2025
1 parent df5a92a commit 6906480
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 66 deletions.
22 changes: 12 additions & 10 deletions generic/tcl.decls
Original file line number Diff line number Diff line change
Expand Up @@ -1025,9 +1025,11 @@ declare 284 {
void Tcl_SetMainLoop(Tcl_MainLoopProc *proc)
}

# Reserved for future use (8.0.x vs. 8.1)
# declare 285 {
# }
declare 285 {
int TclGetAliasObj(Tcl_Interp *interp, const char *childCmd,
Tcl_Interp **targetInterpPtr, const char **targetCmdPtr,
Tcl_Size *objcPtr, Tcl_Obj ***objvPtr)
}

# Added in 8.1:

Expand Down Expand Up @@ -2412,7 +2414,7 @@ declare 649 {
Tcl_Size *numBytesPtr)
}
declare 650 {
unsigned char *TclGetBytesFromObj_(Tcl_Interp *interp, Tcl_Obj *objPtr,
unsigned char *TclGetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
Tcl_Size *numBytesPtr)
}
Expand All @@ -2421,7 +2423,7 @@ declare 651 {
char *TclGetStringFromObj_(Tcl_Obj *objPtr, Tcl_Size *lengthPtr)
}
declare 652 {
Tcl_UniChar *TclGetUnicodeFromObj_(Tcl_Obj *objPtr, Tcl_Size *lengthPtr)
Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, Tcl_Size *lengthPtr)
}
# TIP 660
Expand Down Expand Up @@ -2474,20 +2476,20 @@ declare 662 {
Tcl_Size *lengthPtr)
}
declare 663 {
int TclDictObjSize_(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Size *sizePtr)
int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Size *sizePtr)
}
declare 664 {
int TclSplitList_(Tcl_Interp *interp, const char *listStr, Tcl_Size *argcPtr,
int TclSplitList(Tcl_Interp *interp, const char *listStr, Tcl_Size *argcPtr,
const char ***argvPtr)
}
declare 665 {
void TclSplitPath_(const char *path, Tcl_Size *argcPtr, const char ***argvPtr)
void TclSplitPath(const char *path, Tcl_Size *argcPtr, const char ***argvPtr)
}
declare 666 {
Tcl_Obj *TclFSSplitPath_(Tcl_Obj *pathPtr, Tcl_Size *lenPtr)
Tcl_Obj *TclFSSplitPath(Tcl_Obj *pathPtr, Tcl_Size *lenPtr)
}
declare 667 {
int TclParseArgsObjv_(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable,
int TclParseArgsObjv(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable,
Tcl_Size *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv)
}
Expand Down
87 changes: 47 additions & 40 deletions generic/tclDecls.h
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,12 @@ EXTERN int Tcl_UnstackChannel(Tcl_Interp *interp,
EXTERN Tcl_Channel Tcl_GetStackedChannel(Tcl_Channel chan);
/* 284 */
EXTERN void Tcl_SetMainLoop(Tcl_MainLoopProc *proc);
/* Slot 285 is reserved */
/* 285 */
EXTERN int TclGetAliasObj(Tcl_Interp *interp,
const char *childCmd,
Tcl_Interp **targetInterpPtr,
const char **targetCmdPtr, Tcl_Size *objcPtr,
Tcl_Obj ***objvPtr);
/* 286 */
EXTERN void Tcl_AppendObjToObj(Tcl_Obj *objPtr,
Tcl_Obj *appendObjPtr);
Expand Down Expand Up @@ -1939,13 +1944,13 @@ EXTERN int * Tcl_UtfToUniCharDString(const char *src,
EXTERN unsigned char * Tcl_GetBytesFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Size *numBytesPtr);
/* 650 */
EXTERN unsigned char * TclGetBytesFromObj_(Tcl_Interp *interp,
EXTERN unsigned char * TclGetBytesFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Size *numBytesPtr);
/* 651 */
EXTERN char * TclGetStringFromObj_(Tcl_Obj *objPtr,
Tcl_Size *lengthPtr);
/* 652 */
EXTERN Tcl_UniChar * TclGetUnicodeFromObj_(Tcl_Obj *objPtr,
EXTERN Tcl_UniChar * TclGetUnicodeFromObj(Tcl_Obj *objPtr,
Tcl_Size *lengthPtr);
/* 653 */
EXTERN int Tcl_GetSizeIntFromObj(Tcl_Interp *interp,
Expand Down Expand Up @@ -1982,19 +1987,18 @@ EXTERN int TclListObjGetElements_(Tcl_Interp *interp,
EXTERN int TclListObjLength_(Tcl_Interp *interp,
Tcl_Obj *listPtr, Tcl_Size *lengthPtr);
/* 663 */
EXTERN int TclDictObjSize_(Tcl_Interp *interp, Tcl_Obj *dictPtr,
EXTERN int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr,
Tcl_Size *sizePtr);
/* 664 */
EXTERN int TclSplitList_(Tcl_Interp *interp,
const char *listStr, Tcl_Size *argcPtr,
const char ***argvPtr);
EXTERN int TclSplitList(Tcl_Interp *interp, const char *listStr,
Tcl_Size *argcPtr, const char ***argvPtr);
/* 665 */
EXTERN void TclSplitPath_(const char *path, Tcl_Size *argcPtr,
EXTERN void TclSplitPath(const char *path, Tcl_Size *argcPtr,
const char ***argvPtr);
/* 666 */
EXTERN Tcl_Obj * TclFSSplitPath_(Tcl_Obj *pathPtr, Tcl_Size *lenPtr);
EXTERN Tcl_Obj * TclFSSplitPath(Tcl_Obj *pathPtr, Tcl_Size *lenPtr);
/* 667 */
EXTERN int TclParseArgsObjv_(Tcl_Interp *interp,
EXTERN int TclParseArgsObjv(Tcl_Interp *interp,
const Tcl_ArgvInfo *argTable,
Tcl_Size *objcPtr, Tcl_Obj *const *objv,
Tcl_Obj ***remObjv);
Expand Down Expand Up @@ -2387,7 +2391,7 @@ typedef struct TclStubs {
int (*tcl_UnstackChannel) (Tcl_Interp *interp, Tcl_Channel chan); /* 282 */
Tcl_Channel (*tcl_GetStackedChannel) (Tcl_Channel chan); /* 283 */
void (*tcl_SetMainLoop) (Tcl_MainLoopProc *proc); /* 284 */
void (*reserved285)(void);
int (*tclGetAliasObj) (Tcl_Interp *interp, const char *childCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, Tcl_Size *objcPtr, Tcl_Obj ***objvPtr); /* 285 */
void (*tcl_AppendObjToObj) (Tcl_Obj *objPtr, Tcl_Obj *appendObjPtr); /* 286 */
Tcl_Encoding (*tcl_CreateEncoding) (const Tcl_EncodingType *typePtr); /* 287 */
void (*tcl_CreateThreadExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 288 */
Expand Down Expand Up @@ -2752,9 +2756,9 @@ typedef struct TclStubs {
char * (*tcl_UniCharToUtfDString) (const int *uniStr, Tcl_Size uniLength, Tcl_DString *dsPtr); /* 647 */
int * (*tcl_UtfToUniCharDString) (const char *src, Tcl_Size length, Tcl_DString *dsPtr); /* 648 */
unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *numBytesPtr); /* 649 */
unsigned char * (*tclGetBytesFromObj_) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *numBytesPtr); /* 650 */
unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *numBytesPtr); /* 650 */
char * (*tclGetStringFromObj_) (Tcl_Obj *objPtr, Tcl_Size *lengthPtr); /* 651 */
Tcl_UniChar * (*tclGetUnicodeFromObj_) (Tcl_Obj *objPtr, Tcl_Size *lengthPtr); /* 652 */
Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, Tcl_Size *lengthPtr); /* 652 */
int (*tcl_GetSizeIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *sizePtr); /* 653 */
int (*tcl_UtfCharComplete) (const char *src, Tcl_Size length); /* 654 */
const char * (*tcl_UtfNext) (const char *src); /* 655 */
Expand All @@ -2765,11 +2769,11 @@ typedef struct TclStubs {
int (*tcl_AsyncMarkFromSignal) (Tcl_AsyncHandler async, int sigNumber); /* 660 */
int (*tclListObjGetElements_) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size *objcPtr, Tcl_Obj ***objvPtr); /* 661 */
int (*tclListObjLength_) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size *lengthPtr); /* 662 */
int (*tclDictObjSize_) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Size *sizePtr); /* 663 */
int (*tclSplitList_) (Tcl_Interp *interp, const char *listStr, Tcl_Size *argcPtr, const char ***argvPtr); /* 664 */
void (*tclSplitPath_) (const char *path, Tcl_Size *argcPtr, const char ***argvPtr); /* 665 */
Tcl_Obj * (*tclFSSplitPath_) (Tcl_Obj *pathPtr, Tcl_Size *lenPtr); /* 666 */
int (*tclParseArgsObjv_) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, Tcl_Size *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 667 */
int (*tclDictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Size *sizePtr); /* 663 */
int (*tclSplitList) (Tcl_Interp *interp, const char *listStr, Tcl_Size *argcPtr, const char ***argvPtr); /* 664 */
void (*tclSplitPath) (const char *path, Tcl_Size *argcPtr, const char ***argvPtr); /* 665 */
Tcl_Obj * (*tclFSSplitPath) (Tcl_Obj *pathPtr, Tcl_Size *lenPtr); /* 666 */
int (*tclParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, Tcl_Size *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 667 */
Tcl_Size (*tcl_UniCharLen) (const int *uniStr); /* 668 */
Tcl_Size (*tclNumUtfChars) (const char *src, Tcl_Size length); /* 669 */
Tcl_Size (*tclGetCharLength) (Tcl_Obj *objPtr); /* 670 */
Expand Down Expand Up @@ -3394,7 +3398,8 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_GetStackedChannel) /* 283 */
#define Tcl_SetMainLoop \
(tclStubsPtr->tcl_SetMainLoop) /* 284 */
/* Slot 285 is reserved */
#define TclGetAliasObj \
(tclStubsPtr->tclGetAliasObj) /* 285 */
#define Tcl_AppendObjToObj \
(tclStubsPtr->tcl_AppendObjToObj) /* 286 */
#define Tcl_CreateEncoding \
Expand Down Expand Up @@ -4123,12 +4128,12 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_UtfToUniCharDString) /* 648 */
#define Tcl_GetBytesFromObj \
(tclStubsPtr->tcl_GetBytesFromObj) /* 649 */
#define TclGetBytesFromObj_ \
(tclStubsPtr->tclGetBytesFromObj_) /* 650 */
#define TclGetBytesFromObj \
(tclStubsPtr->tclGetBytesFromObj) /* 650 */
#define TclGetStringFromObj_ \
(tclStubsPtr->tclGetStringFromObj_) /* 651 */
#define TclGetUnicodeFromObj_ \
(tclStubsPtr->tclGetUnicodeFromObj_) /* 652 */
#define TclGetUnicodeFromObj \
(tclStubsPtr->tclGetUnicodeFromObj) /* 652 */
#define Tcl_GetSizeIntFromObj \
(tclStubsPtr->tcl_GetSizeIntFromObj) /* 653 */
#define Tcl_UtfCharComplete \
Expand All @@ -4149,16 +4154,16 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tclListObjGetElements_) /* 661 */
#define TclListObjLength_ \
(tclStubsPtr->tclListObjLength_) /* 662 */
#define TclDictObjSize_ \
(tclStubsPtr->tclDictObjSize_) /* 663 */
#define TclSplitList_ \
(tclStubsPtr->tclSplitList_) /* 664 */
#define TclSplitPath_ \
(tclStubsPtr->tclSplitPath_) /* 665 */
#define TclFSSplitPath_ \
(tclStubsPtr->tclFSSplitPath_) /* 666 */
#define TclParseArgsObjv_ \
(tclStubsPtr->tclParseArgsObjv_) /* 667 */
#define TclDictObjSize \
(tclStubsPtr->tclDictObjSize) /* 663 */
#define TclSplitList \
(tclStubsPtr->tclSplitList) /* 664 */
#define TclSplitPath \
(tclStubsPtr->tclSplitPath) /* 665 */
#define TclFSSplitPath \
(tclStubsPtr->tclFSSplitPath) /* 666 */
#define TclParseArgsObjv \
(tclStubsPtr->tclParseArgsObjv) /* 667 */
#define Tcl_UniCharLen \
(tclStubsPtr->tcl_UniCharLen) /* 668 */
#define TclNumUtfChars \
Expand Down Expand Up @@ -4483,6 +4488,8 @@ extern const TclStubs *tclStubsPtr;
# define Tcl_UtfNcmp TclUtfNcmp
# undef Tcl_UtfNcasecmp
# define Tcl_UtfNcasecmp TclUtfNcasecmp
# undef Tcl_GetUnicodeFromObj
# define Tcl_GetUnicodeFromObj TclGetUnicodeFromObj
#endif
#if defined(USE_TCL_STUBS)
# define Tcl_WCharToUtfDString (sizeof(wchar_t) != sizeof(short) \
Expand Down Expand Up @@ -4555,16 +4562,16 @@ extern const TclStubs *tclStubsPtr;
#undef Tcl_NRCreateCommand2
#define Tcl_NRCreateCommand2 Tcl_NRCreateCommand

#undef TclDictObjSize_
#undef TclFSSplitPath_
#undef TclDictObjSize
#undef TclFSSplitPath
#undef TclListObjGetElements_
#undef TclListObjLength_
#undef TclParseArgsObjv_
#undef TclSplitList_
#undef TclSplitPath_
#undef TclGetBytesFromObj_
#undef TclParseArgsObjv
#undef TclSplitList
#undef TclSplitPath
#undef TclGetBytesFromObj
#undef TclGetStringFromObj_
#undef TclGetUnicodeFromObj_
#undef TclGetAliasObj

/* TIP #660 */
#undef Tcl_GetSizeIntFromObj
Expand Down
1 change: 0 additions & 1 deletion generic/tclInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -3502,7 +3502,6 @@ MODULE_SCOPE int TclZipfs_Init(Tcl_Interp *interp);
MODULE_SCOPE int TclIsZipfsPath(const char *path);
MODULE_SCOPE void TclZipfsFinalize(void);

MODULE_SCOPE int *TclGetUnicodeFromObj(Tcl_Obj *, int *);
MODULE_SCOPE Tcl_Obj *TclNewUnicodeObj(const int *, int);
MODULE_SCOPE void TclAppendUnicodeToObj(Tcl_Obj *, const int *, int);
MODULE_SCOPE int TclUniCharNcasecmp(const int *, const int *, size_t);
Expand Down
30 changes: 15 additions & 15 deletions generic/tclStubInit.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@
#define TclWinConvertError (void (*)(DWORD))(void *)Tcl_WinConvertError
#endif

#define TclDictObjSize_ Tcl_DictObjSize
#define TclFSSplitPath_ Tcl_FSSplitPath
#define TclDictObjSize Tcl_DictObjSize
#define TclFSSplitPath Tcl_FSSplitPath
#define TclListObjGetElements_ Tcl_ListObjGetElements
#define TclListObjLength_ Tcl_ListObjLength
#define TclParseArgsObjv_ Tcl_ParseArgsObjv
#define TclSplitList_ Tcl_SplitList
#define TclSplitPath_ Tcl_SplitPath
#define TclGetBytesFromObj_ Tcl_GetBytesFromObj
#define TclParseArgsObjv Tcl_ParseArgsObjv
#define TclSplitList Tcl_SplitList
#define TclSplitPath Tcl_SplitPath
#define TclGetBytesFromObj Tcl_GetBytesFromObj
#define TclGetStringFromObj_ Tcl_GetStringFromObj
#define TclGetUnicodeFromObj_ TclGetUnicodeFromObj
#define TclGetAliasObj Tcl_GetAliasObj


#if defined(TCL_NO_DEPRECATED)
Expand Down Expand Up @@ -1592,7 +1592,7 @@ const TclStubs tclStubs = {
Tcl_UnstackChannel, /* 282 */
Tcl_GetStackedChannel, /* 283 */
Tcl_SetMainLoop, /* 284 */
0, /* 285 */
TclGetAliasObj, /* 285 */
Tcl_AppendObjToObj, /* 286 */
Tcl_CreateEncoding, /* 287 */
Tcl_CreateThreadExitHandler, /* 288 */
Expand Down Expand Up @@ -1957,9 +1957,9 @@ const TclStubs tclStubs = {
Tcl_UniCharToUtfDString, /* 647 */
Tcl_UtfToUniCharDString, /* 648 */
Tcl_GetBytesFromObj, /* 649 */
TclGetBytesFromObj_, /* 650 */
TclGetBytesFromObj, /* 650 */
TclGetStringFromObj_, /* 651 */
TclGetUnicodeFromObj_, /* 652 */
TclGetUnicodeFromObj, /* 652 */
Tcl_GetSizeIntFromObj, /* 653 */
Tcl_UtfCharComplete, /* 654 */
Tcl_UtfNext, /* 655 */
Expand All @@ -1970,11 +1970,11 @@ const TclStubs tclStubs = {
Tcl_AsyncMarkFromSignal, /* 660 */
TclListObjGetElements_, /* 661 */
TclListObjLength_, /* 662 */
TclDictObjSize_, /* 663 */
TclSplitList_, /* 664 */
TclSplitPath_, /* 665 */
TclFSSplitPath_, /* 666 */
TclParseArgsObjv_, /* 667 */
TclDictObjSize, /* 663 */
TclSplitList, /* 664 */
TclSplitPath, /* 665 */
TclFSSplitPath, /* 666 */
TclParseArgsObjv, /* 667 */
Tcl_UniCharLen, /* 668 */
TclNumUtfChars, /* 669 */
TclGetCharLength, /* 670 */
Expand Down

0 comments on commit 6906480

Please sign in to comment.