Compare commits

...
Author SHA1 Message Date
stu 58a1e3a324 Change the return type of Tcl_RegisterChannel from void to Tcl_Channel and have Tcl_RegisterChannel return the channel. his is a convenience to the programmer. 2017-06-05 18:33:57 +00:00
stu 43504d449b Change the return type of Tcl_WrongNumArgs from void to int
and have Tcl_WrongNumArgs always return TCL_ERROR.
This is a convenience to the programmer.
Most of the time in existing code, a call to Tcl_WrongNumArgs
is immediately followed by return TCL_ERROR.

Old: Tcl_WrongNumArgs(...); return TCL_ERROR;

New: return Tcl_WrongNumArgs(...);
2017-05-31 06:59:27 +00:00
stu 5e6bac514b Merge trunk. 2017-05-31 06:48:06 +00:00
stu 14dd351c95 Bring up-to-date. 2017-05-31 04:43:16 +00:00
stwo 14e867f82b merge trunk 2014-09-11 04:31:04 +00:00
stwo 368c0890ab merge trunk 2012-08-09 00:25:12 +00:00
stwo 8c908a8136 Initial implementation of frq [3551813], use @ to report offset in [binary scan]. 2012-08-05 15:12:43 +00:00
168 changed files with 77 additions and 81 deletions
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Regular → Executable
View File
Regular → Executable
View File
+3 -1
View File
@@ -32,7 +32,7 @@ int
int
\fBTcl_GetChannelNamesEx\fR(\fIinterp, pattern\fR)
.sp
void
Tcl_Channel
\fBTcl_RegisterChannel\fR(\fIinterp, channel\fR)
.sp
int
@@ -319,6 +319,8 @@ the name given in the call to \fBTcl_CreateChannel\fR. After this call,
the channel becomes the property of the interpreter, and the caller should
not call \fBTcl_Close\fR for the channel; the channel will be closed
automatically when it is unregistered from the interpreter.
\fBTcl_RegisterChannel\fR returns the channel, as a convenience to the
programmer,
.PP
Code executing outside of any Tcl interpreter can call
\fBTcl_RegisterChannel\fR with \fIinterp\fR as NULL, to indicate that it
+4
View File
@@ -13,6 +13,7 @@ Tcl_WrongNumArgs \- generate standard error message for wrong number of argument
.nf
\fB#include <tcl.h>\fR
.sp
int
\fBTcl_WrongNumArgs\fR(\fIinterp, objc, objv, message\fR)
.SH ARGUMENTS
.AS "Tcl_Obj *const" *message
@@ -73,6 +74,9 @@ is now an \fIindexObject\fR because it was passed to
.CS
wrong # args: should be "foo barfly fileName count"
.CE
.PP
\fBTcl_WrongNumArgs\fR always returns TCL_ERRROR, as a convenience to
the programmer.
.SH "SEE ALSO"
Tcl_GetIndexFromObj(3)
.SH KEYWORDS
+7 -2
View File
@@ -846,8 +846,13 @@ stored in \fIvar2\fR.
Moves the cursor to the absolute location in the data string specified
by \fIcount\fR. Note that position 0 refers to the first byte in
\fIstring\fR. If \fIcount\fR refers to a position beyond the end of
\fIstring\fR, then the cursor is positioned after the last byte. If
\fIcount\fR is omitted, then an error will be generated. For example,
\fIstring\fR, then the cursor is positioned after the last byte.
.VS 8.6
If \fIcount\fR is omitted, then the cursor position in the data string
will be stored in the corresponding variable and an argument will be
consumed. If count is supplied then no argument is consumed.
.VE 8.6
For example,
.RS
.CS
\fBbinary scan\fR \ex01\ex02\ex03\ex04 c2@1H* var1 var2
Regular → Executable
View File
+2 -2
View File
@@ -748,7 +748,7 @@ declare 209 {
int Tcl_RecordAndEvalObj(Tcl_Interp *interp, Tcl_Obj *cmdPtr, int flags)
}
declare 210 {
void Tcl_RegisterChannel(Tcl_Interp *interp, Tcl_Channel chan)
Tcl_Channel Tcl_RegisterChannel(Tcl_Interp *interp, Tcl_Channel chan)
}
declare 211 {
void Tcl_RegisterObjType(const Tcl_ObjType *typePtr)
@@ -936,7 +936,7 @@ declare 263 {
int Tcl_Write(Tcl_Channel chan, const char *s, int slen)
}
declare 264 {
void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc,
int Tcl_WrongNumArgs(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], const char *message)
}
declare 265 {
+13 -8
View File
@@ -1634,10 +1634,19 @@ BinaryScanCmd(
break;
case '@':
if (count == BINARY_NOCOUNT) {
DeleteScanNumberCache(numberCachePtr);
goto badCount;
}
if ((count == BINARY_ALL) || (count > length)) {
if (arg >= objc) {
DeleteScanNumberCache(numberCachePtr);
goto badIndex;
}
valuePtr = Tcl_NewIntObj(offset);
resultPtr = Tcl_ObjSetVar2(interp, objv[arg], NULL,
valuePtr, TCL_LEAVE_ERR_MSG);
arg++;
if (resultPtr == NULL) {
DeleteScanNumberCache(numberCachePtr);
return TCL_ERROR;
}
} else if ((count == BINARY_ALL) || (count > length)) {
offset = length;
} else {
offset = count;
@@ -1660,10 +1669,6 @@ BinaryScanCmd(
return TCL_OK;
badCount:
errorString = "missing count for \"@\" field specifier";
goto error;
badIndex:
errorString = "not enough arguments for all format specifiers";
goto error;
+4 -4
View File
@@ -633,7 +633,7 @@ EXTERN int Tcl_RecordAndEval(Tcl_Interp *interp,
EXTERN int Tcl_RecordAndEvalObj(Tcl_Interp *interp,
Tcl_Obj *cmdPtr, int flags);
/* 210 */
EXTERN void Tcl_RegisterChannel(Tcl_Interp *interp,
EXTERN Tcl_Channel Tcl_RegisterChannel(Tcl_Interp *interp,
Tcl_Channel chan);
/* 211 */
EXTERN void Tcl_RegisterObjType(const Tcl_ObjType *typePtr);
@@ -796,7 +796,7 @@ EXTERN ClientData Tcl_VarTraceInfo2(Tcl_Interp *interp,
/* 263 */
EXTERN int Tcl_Write(Tcl_Channel chan, const char *s, int slen);
/* 264 */
EXTERN void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc,
EXTERN int Tcl_WrongNumArgs(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[], const char *message);
/* 265 */
EXTERN int Tcl_DumpActiveMemory(const char *fileName);
@@ -2067,7 +2067,7 @@ typedef struct TclStubs {
void (*tcl_ReapDetachedProcs) (void); /* 207 */
int (*tcl_RecordAndEval) (Tcl_Interp *interp, const char *cmd, int flags); /* 208 */
int (*tcl_RecordAndEvalObj) (Tcl_Interp *interp, Tcl_Obj *cmdPtr, int flags); /* 209 */
void (*tcl_RegisterChannel) (Tcl_Interp *interp, Tcl_Channel chan); /* 210 */
Tcl_Channel (*tcl_RegisterChannel) (Tcl_Interp *interp, Tcl_Channel chan); /* 210 */
void (*tcl_RegisterObjType) (const Tcl_ObjType *typePtr); /* 211 */
Tcl_RegExp (*tcl_RegExpCompile) (Tcl_Interp *interp, const char *pattern); /* 212 */
int (*tcl_RegExpExec) (Tcl_Interp *interp, Tcl_RegExp regexp, const char *text, const char *start); /* 213 */
@@ -2121,7 +2121,7 @@ typedef struct TclStubs {
ClientData (*tcl_VarTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 261 */
ClientData (*tcl_VarTraceInfo2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 262 */
int (*tcl_Write) (Tcl_Channel chan, const char *s, int slen); /* 263 */
void (*tcl_WrongNumArgs) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *message); /* 264 */
int (*tcl_WrongNumArgs) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *message); /* 264 */
int (*tcl_DumpActiveMemory) (const char *fileName); /* 265 */
void (*tcl_ValidateAllMemory) (const char *file, int line); /* 266 */
void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */
+5 -3
View File
@@ -1138,7 +1138,7 @@ Tcl_IsStandardChannel(
* channel refCount.
*
* Results:
* None.
* The channel.
*
* Side effects:
* May increment the reference count of a channel.
@@ -1146,7 +1146,7 @@ Tcl_IsStandardChannel(
*----------------------------------------------------------------------
*/
void
Tcl_Channel
Tcl_RegisterChannel(
Tcl_Interp *interp, /* Interpreter in which to add the channel. */
Tcl_Channel chan) /* The channel to add to this interpreter
@@ -1175,7 +1175,7 @@ Tcl_RegisterChannel(
hPtr = Tcl_CreateHashEntry(hTblPtr, statePtr->channelName, &isNew);
if (!isNew) {
if (chan == Tcl_GetHashValue(hPtr)) {
return;
return chan;
}
Tcl_Panic("Tcl_RegisterChannel: duplicate channel names");
@@ -1183,6 +1183,8 @@ Tcl_RegisterChannel(
Tcl_SetHashValue(hPtr, chanPtr);
}
statePtr->refCount++;
return chan;
}
/*
+4 -2
View File
@@ -836,7 +836,7 @@ PrefixLongestObjCmd(
* functions, including the function that implements procedures.
*
* Results:
* None.
* Always returns TCL_ERROR, as a convenience to the programmer.
*
* Side effects:
* An error message is generated in interp's result object to indicate
@@ -865,7 +865,7 @@ PrefixLongestObjCmd(
*----------------------------------------------------------------------
*/
void
int
Tcl_WrongNumArgs(
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments to print from objv. */
@@ -1059,6 +1059,8 @@ Tcl_WrongNumArgs(
Tcl_SetObjResult(interp, objPtr);
#undef MAY_QUOTE_WORD
#undef AFTER_FIRST_WORD
return TCL_ERROR;
}
/*
Regular → Executable
View File
-58
View File
@@ -1,58 +0,0 @@
/*
* tclStubLibTbl.c --
*
* Stub object that will be statically linked into extensions that want
* to access Tcl.
*
* Copyright (c) 1998-1999 by Scriptics Corporation.
* Copyright (c) 1998 Paul Duffin.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tclInt.h"
/*
*----------------------------------------------------------------------
*
* TclInitStubTable --
*
* Initialize the stub table, using the structure pointed at
* by the "version" argument.
*
* Results:
* Outputs the value of the "version" argument.
*
* Side effects:
* Sets the stub table pointers.
*
*----------------------------------------------------------------------
*/
MODULE_SCOPE const char *
TclInitStubTable(
const char *version) /* points to the version field of a
TclStubInfoType structure variable. */
{
tclStubsPtr = ((const TclStubInfoType *) version)->stubs;
if (tclStubsPtr->hooks) {
tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
} else {
tclPlatStubsPtr = NULL;
tclIntStubsPtr = NULL;
tclIntPlatStubsPtr = NULL;
}
return version;
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File

Some files were not shown because too many files have changed in this diff Show More