summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-09-13 21:23:51 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-09-13 21:23:51 (GMT)
commitc483a47557d64385bc3cc9f65aedf8b6bf387843 (patch)
tree4ec0eea5f561d67d221ac1cac6c7ccde0cf4c8e9 /generic
parent0f676d700286952cb2db293c6dd1320dd31e7fe9 (diff)
downloadtcl-c483a47557d64385bc3cc9f65aedf8b6bf387843.zip
tcl-c483a47557d64385bc3cc9f65aedf8b6bf387843.tar.gz
tcl-c483a47557d64385bc3cc9f65aedf8b6bf387843.tar.bz2
* generic/tcl.h: Explicitly standardized on the use of stdarg.h
* generic/tclBasic.c: conventions for functions with variable number * generic/tclInt.h: of arguments. Support for varargs.h has been * generic/tclPanic.c: implicitly gone for some time now. All * generic/tclResult.c: TCL_VARARGS* macros purged from Tcl sources, * generic/tclStringObj.c: leaving only some deprecated #define's * tools/genStubs.tcl: in tcl.h for the sake of older extensions. * generic/tclDecls.h: make genstubs * doc/AddErrInfo.3: Replaced all documented requirement for use * doc/Eval.3: of TCL_VARARGS_START() with requirement for * doc/Panic.3: use of va_start(). * doc/SetResult.3: * doc/StringObj.3:
Diffstat (limited to 'generic')
-rw-r--r--generic/tcl.h34
-rw-r--r--generic/tclBasic.c9
-rw-r--r--generic/tclDecls.h22
-rw-r--r--generic/tclInt.h8
-rw-r--r--generic/tclPanic.c9
-rw-r--r--generic/tclResult.c13
-rw-r--r--generic/tclStringObj.c17
7 files changed, 51 insertions, 61 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index ff80a84..f75ae6f 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tcl.h,v 1.202 2005/09/08 10:49:19 dkf Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.203 2005/09/13 21:23:51 dgp Exp $
*/
#ifndef _TCL
@@ -153,26 +153,20 @@ extern "C" {
#include <stdio.h>
/*
- * Definitions that allow Tcl functions with variable numbers of arguments to
- * be used with either varargs.h or stdarg.h. TCL_VARARGS is used in function
- * prototypes. TCL_VARARGS_DEF is used to declare the arguments in a function
- * definiton: it takes the type and name of the first argument and supplies
- * the appropriate argument declaration string for use in the function
- * definition. TCL_VARARGS_START initializes the va_list data structure and
- * returns the first argument.
+ * Support for functions with a variable number of arguments.
+ *
+ * The following TCL_VARARGS* macros are to support old extensions
+ * written for older versions of Tcl where the macros permitted
+ * support for the varargs.h system as well as stdarg.h .
+ *
+ * New code should just directly be written to use stdarg.h conventions.
*/
-#if !defined(NO_STDARG)
-# include <stdarg.h>
-# define TCL_VARARGS(type, name) (type name, ...)
-# define TCL_VARARGS_DEF(type, name) (type name, ...)
-# define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
-#else
-# include <varargs.h>
-# define TCL_VARARGS(type, name) ()
-# define TCL_VARARGS_DEF(type, name) (va_alist)
-# define TCL_VARARGS_START(type, name, list) \
- (va_start(list), va_arg(list, type))
+#include <stdarg.h>
+#ifndef TCL_NO_DEPRECATED
+# define TCL_VARARGS(type, name) (type name, ...)
+# define TCL_VARARGS_DEF(type, name) (type name, ...)
+# define TCL_VARARGS_START(type, name, list) (va_start(list, name), name)
#endif
/*
@@ -694,7 +688,7 @@ typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData,
typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
typedef int (Tcl_PackageUnloadProc) _ANSI_ARGS_((Tcl_Interp *interp,
int flags));
-typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(CONST char *, format));
+typedef void (Tcl_PanicProc) _ANSI_ARGS_((CONST char *format, ...));
typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData,
Tcl_Channel chan, char *address, int port));
typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData));
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index e9c12d9..7266c08 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.169 2005/09/06 14:40:10 dkf Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.170 2005/09/13 21:23:51 dgp Exp $
*/
#include "tclInt.h"
@@ -4859,15 +4859,14 @@ Tcl_VarEvalVA(interp, argList)
*
*----------------------------------------------------------------------
*/
- /* VARARGS2 */ /* ARGSUSED */
+ /* ARGSUSED */
int
-Tcl_VarEval TCL_VARARGS_DEF(Tcl_Interp *,arg1)
+Tcl_VarEval(Tcl_Interp *interp, ...)
{
- Tcl_Interp *interp;
va_list argList;
int result;
- interp = TCL_VARARGS_START(Tcl_Interp *,arg1,argList);
+ va_start(argList, interp);
result = Tcl_VarEvalVA(interp, argList);
va_end(argList);
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index d10cb4c..4528521 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclDecls.h,v 1.115 2005/08/24 17:56:23 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclDecls.h,v 1.116 2005/09/13 21:23:51 dgp Exp $
*/
#ifndef _TCLDECLS
@@ -55,7 +55,7 @@ EXTERN CONST84_RETURN char * Tcl_PkgRequireEx _ANSI_ARGS_((
#ifndef Tcl_Panic_TCL_DECLARED
#define Tcl_Panic_TCL_DECLARED
/* 2 */
-EXTERN void Tcl_Panic _ANSI_ARGS_(TCL_VARARGS(CONST char *,format));
+EXTERN void Tcl_Panic _ANSI_ARGS_((CONST char *format, ...));
#endif
#ifndef Tcl_Alloc_TCL_DECLARED
#define Tcl_Alloc_TCL_DECLARED
@@ -131,7 +131,7 @@ EXTERN int Tcl_AppendAllObjTypes _ANSI_ARGS_((
#ifndef Tcl_AppendStringsToObj_TCL_DECLARED
#define Tcl_AppendStringsToObj_TCL_DECLARED
/* 15 */
-EXTERN void Tcl_AppendStringsToObj _ANSI_ARGS_(TCL_VARARGS(Tcl_Obj *,objPtr));
+EXTERN void Tcl_AppendStringsToObj _ANSI_ARGS_((Tcl_Obj *objPtr, ...));
#endif
#ifndef Tcl_AppendToObj_TCL_DECLARED
#define Tcl_AppendToObj_TCL_DECLARED
@@ -461,7 +461,7 @@ EXTERN void Tcl_AppendElement _ANSI_ARGS_((Tcl_Interp * interp,
#ifndef Tcl_AppendResult_TCL_DECLARED
#define Tcl_AppendResult_TCL_DECLARED
/* 70 */
-EXTERN void Tcl_AppendResult _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp));
+EXTERN void Tcl_AppendResult _ANSI_ARGS_((Tcl_Interp *interp, ...));
#endif
#ifndef Tcl_AsyncCreate_TCL_DECLARED
#define Tcl_AsyncCreate_TCL_DECLARED
@@ -1450,7 +1450,7 @@ EXTERN void Tcl_SetErrno _ANSI_ARGS_((int err));
#ifndef Tcl_SetErrorCode_TCL_DECLARED
#define Tcl_SetErrorCode_TCL_DECLARED
/* 228 */
-EXTERN void Tcl_SetErrorCode _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp));
+EXTERN void Tcl_SetErrorCode _ANSI_ARGS_((Tcl_Interp *interp, ...));
#endif
#ifndef Tcl_SetMaxBlockTime_TCL_DECLARED
#define Tcl_SetMaxBlockTime_TCL_DECLARED
@@ -1653,7 +1653,7 @@ EXTERN int Tcl_UpVar2 _ANSI_ARGS_((Tcl_Interp * interp,
#ifndef Tcl_VarEval_TCL_DECLARED
#define Tcl_VarEval_TCL_DECLARED
/* 260 */
-EXTERN int Tcl_VarEval _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp));
+EXTERN int Tcl_VarEval _ANSI_ARGS_((Tcl_Interp *interp, ...));
#endif
#ifndef Tcl_VarTraceInfo_TCL_DECLARED
#define Tcl_VarTraceInfo_TCL_DECLARED
@@ -3533,7 +3533,7 @@ typedef struct TclStubs {
int (*tcl_PkgProvideEx) _ANSI_ARGS_((Tcl_Interp* interp, CONST char* name, CONST char* version, ClientData clientData)); /* 0 */
CONST84_RETURN char * (*tcl_PkgRequireEx) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name, CONST char * version, int exact, ClientData * clientDataPtr)); /* 1 */
- void (*tcl_Panic) _ANSI_ARGS_(TCL_VARARGS(CONST char *,format)); /* 2 */
+ void (*tcl_Panic) _ANSI_ARGS_((CONST char *format, ...)); /* 2 */
char * (*tcl_Alloc) _ANSI_ARGS_((unsigned int size)); /* 3 */
void (*tcl_Free) _ANSI_ARGS_((char * ptr)); /* 4 */
char * (*tcl_Realloc) _ANSI_ARGS_((char * ptr, unsigned int size)); /* 5 */
@@ -3556,7 +3556,7 @@ typedef struct TclStubs {
void (*tcl_Sleep) _ANSI_ARGS_((int ms)); /* 12 */
int (*tcl_WaitForEvent) _ANSI_ARGS_((Tcl_Time * timePtr)); /* 13 */
int (*tcl_AppendAllObjTypes) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr)); /* 14 */
- void (*tcl_AppendStringsToObj) _ANSI_ARGS_(TCL_VARARGS(Tcl_Obj *,objPtr)); /* 15 */
+ void (*tcl_AppendStringsToObj) _ANSI_ARGS_((Tcl_Obj *objPtr, ...)); /* 15 */
void (*tcl_AppendToObj) _ANSI_ARGS_((Tcl_Obj* objPtr, CONST char* bytes, int length)); /* 16 */
Tcl_Obj * (*tcl_ConcatObj) _ANSI_ARGS_((int objc, Tcl_Obj *CONST objv[])); /* 17 */
int (*tcl_ConvertToType) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, Tcl_ObjType * typePtr)); /* 18 */
@@ -3611,7 +3611,7 @@ typedef struct TclStubs {
void (*tcl_AddObjErrorInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * message, int length)); /* 67 */
void (*tcl_AllowExceptions) _ANSI_ARGS_((Tcl_Interp * interp)); /* 68 */
void (*tcl_AppendElement) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * element)); /* 69 */
- void (*tcl_AppendResult) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); /* 70 */
+ void (*tcl_AppendResult) _ANSI_ARGS_((Tcl_Interp *interp, ...)); /* 70 */
Tcl_AsyncHandler (*tcl_AsyncCreate) _ANSI_ARGS_((Tcl_AsyncProc * proc, ClientData clientData)); /* 71 */
void (*tcl_AsyncDelete) _ANSI_ARGS_((Tcl_AsyncHandler async)); /* 72 */
int (*tcl_AsyncInvoke) _ANSI_ARGS_((Tcl_Interp * interp, int code)); /* 73 */
@@ -3789,7 +3789,7 @@ typedef struct TclStubs {
int (*tcl_SetChannelOption) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Channel chan, CONST char * optionName, CONST char * newValue)); /* 225 */
int (*tcl_SetCommandInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * cmdName, CONST Tcl_CmdInfo * infoPtr)); /* 226 */
void (*tcl_SetErrno) _ANSI_ARGS_((int err)); /* 227 */
- void (*tcl_SetErrorCode) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); /* 228 */
+ void (*tcl_SetErrorCode) _ANSI_ARGS_((Tcl_Interp *interp, ...)); /* 228 */
void (*tcl_SetMaxBlockTime) _ANSI_ARGS_((Tcl_Time * timePtr)); /* 229 */
void (*tcl_SetPanicProc) _ANSI_ARGS_((Tcl_PanicProc * panicProc)); /* 230 */
int (*tcl_SetRecursionLimit) _ANSI_ARGS_((Tcl_Interp * interp, int depth)); /* 231 */
@@ -3821,7 +3821,7 @@ typedef struct TclStubs {
void (*tcl_UpdateLinkedVar) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * varName)); /* 257 */
int (*tcl_UpVar) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * frameName, CONST char * varName, CONST char * localName, int flags)); /* 258 */
int (*tcl_UpVar2) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * frameName, CONST char * part1, CONST char * part2, CONST char * localName, int flags)); /* 259 */
- int (*tcl_VarEval) _ANSI_ARGS_(TCL_VARARGS(Tcl_Interp *,interp)); /* 260 */
+ int (*tcl_VarEval) _ANSI_ARGS_((Tcl_Interp *interp, ...)); /* 260 */
ClientData (*tcl_VarTraceInfo) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * varName, int flags, Tcl_VarTraceProc * procPtr, ClientData prevClientData)); /* 261 */
ClientData (*tcl_VarTraceInfo2) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * part1, CONST char * part2, int flags, Tcl_VarTraceProc * procPtr, ClientData prevClientData)); /* 262 */
int (*tcl_Write) _ANSI_ARGS_((Tcl_Channel chan, CONST char * s, int slen)); /* 263 */
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 689f95f..43d12c7 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclInt.h,v 1.250 2005/09/09 17:47:18 dgp Exp $
+ * RCS: @(#) $Id: tclInt.h,v 1.251 2005/09/13 21:23:51 dgp Exp $
*/
#ifndef _TCLINT
@@ -2001,7 +2001,7 @@ MODULE_SCOPE void TclFinalizePreserve(void);
MODULE_SCOPE void TclFinalizeSynchronization(void);
MODULE_SCOPE void TclFinalizeThreadData(void);
MODULE_SCOPE void TclFormatNaN(double value, char* buffer);
-MODULE_SCOPE int TclFormatObj TCL_VARARGS(Tcl_Interp *, arg1);
+MODULE_SCOPE int TclFormatObj(Tcl_Interp *arg1, ...);
MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr,
CONST char *attributeName, int *indexPtr);
MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp);
@@ -2053,7 +2053,7 @@ MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc,
MODULE_SCOPE int TclObjInvokeNamespace(Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[],
Tcl_Namespace *nsPtr, int flags);
-MODULE_SCOPE int TclObjPrintf TCL_VARARGS(Tcl_Interp *, arg1);
+MODULE_SCOPE int TclObjPrintf(Tcl_Interp *arg1, ...);
MODULE_SCOPE int TclParseBackslash(CONST char *src,
int numBytes, int *readPtr, char *dst);
MODULE_SCOPE int TclParseHex(CONST char *src, int numBytes,
@@ -2112,7 +2112,7 @@ MODULE_SCOPE Tcl_Obj* TclpObjLink(Tcl_Obj *pathPtr, Tcl_Obj *toPtr,
MODULE_SCOPE int TclpObjChdir(Tcl_Obj *pathPtr);
MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr,
Tcl_PathPart portion);
-MODULE_SCOPE void TclpPanic TCL_VARARGS(CONST char *, format);
+MODULE_SCOPE void TclpPanic(CONST char *format, ...);
MODULE_SCOPE char * TclpReadlink(CONST char *fileName,
Tcl_DString *linkPtr);
MODULE_SCOPE void TclpReleaseFile(TclFile file);
diff --git a/generic/tclPanic.c b/generic/tclPanic.c
index 9b1c36f..b69706c 100644
--- a/generic/tclPanic.c
+++ b/generic/tclPanic.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPanic.c,v 1.6 2005/07/19 22:45:35 dkf Exp $
+ * RCS: @(#) $Id: tclPanic.c,v 1.7 2005/09/13 21:23:51 dgp Exp $
*/
#include "tclInt.h"
@@ -120,14 +120,13 @@ Tcl_PanicVA(format, argList)
*----------------------------------------------------------------------
*/
- /* VARARGS ARGSUSED */
+ /* ARGSUSED */
void
-Tcl_Panic TCL_VARARGS_DEF(CONST char *,arg1)
+Tcl_Panic(CONST char *format, ...)
{
va_list argList;
- CONST char *format;
- format = TCL_VARARGS_START(CONST char *,arg1,argList);
+ va_start(argList, format);
Tcl_PanicVA(format, argList);
va_end (argList);
}
diff --git a/generic/tclResult.c b/generic/tclResult.c
index 1cc9028..53b45a0 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclResult.c,v 1.30 2005/09/02 19:23:46 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclResult.c,v 1.31 2005/09/13 21:23:51 dgp Exp $
*/
#include "tclInt.h"
@@ -663,12 +663,11 @@ Tcl_AppendResultVA(interp, argList)
*/
void
-Tcl_AppendResult TCL_VARARGS_DEF(Tcl_Interp *,arg1)
+Tcl_AppendResult(Tcl_Interp *interp, ...)
{
- Tcl_Interp *interp;
va_list argList;
- interp = TCL_VARARGS_START(Tcl_Interp *,arg1,argList);
+ va_start(argList, interp);
Tcl_AppendResultVA(interp, argList);
va_end(argList);
}
@@ -1030,11 +1029,9 @@ Tcl_SetErrorCodeVA(interp, argList)
*----------------------------------------------------------------------
*/
- /* VARARGS2 */
void
-Tcl_SetErrorCode TCL_VARARGS_DEF(Tcl_Interp *,arg1)
+Tcl_SetErrorCode(Tcl_Interp *interp, ...)
{
- Tcl_Interp *interp;
va_list argList;
/*
@@ -1042,7 +1039,7 @@ Tcl_SetErrorCode TCL_VARARGS_DEF(Tcl_Interp *,arg1)
* errorCode field as list elements.
*/
- interp = TCL_VARARGS_START(Tcl_Interp *,arg1,argList);
+ va_start(argList, interp);
Tcl_SetErrorCodeVA(interp, argList);
va_end(argList);
}
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index dd1a2eb..0b2cdb2 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -33,7 +33,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStringObj.c,v 1.43 2005/09/12 14:31:15 dgp Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.44 2005/09/13 21:23:51 dgp Exp $ */
#include "tclInt.h"
@@ -1662,12 +1662,11 @@ Tcl_AppendStringsToObjVA (objPtr, argList)
*/
void
-Tcl_AppendStringsToObj TCL_VARARGS_DEF(Tcl_Obj *,arg1)
+Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...)
{
- register Tcl_Obj *objPtr;
va_list argList;
- objPtr = TCL_VARARGS_START(Tcl_Obj *,arg1,argList);
+ va_start(argList, objPtr);
Tcl_AppendStringsToObjVA(objPtr, argList);
va_end(argList);
}
@@ -2260,11 +2259,12 @@ FormatObjVA(interp, argList)
*/
int
-TclFormatObj TCL_VARARGS_DEF(Tcl_Interp *,arg1)
+TclFormatObj(Tcl_Interp *interp, ...)
{
va_list argList;
int result;
- Tcl_Interp *interp = TCL_VARARGS_START(Tcl_Interp *,arg1,argList);
+
+ va_start(argList, interp);
result = FormatObjVA(interp, argList);
va_end(argList);
return result;
@@ -2384,11 +2384,12 @@ ObjPrintfVA(interp, argList)
*/
int
-TclObjPrintf TCL_VARARGS_DEF(Tcl_Interp *,arg1)
+TclObjPrintf(Tcl_Interp *interp, ...)
{
va_list argList;
int result;
- Tcl_Interp *interp = TCL_VARARGS_START(Tcl_Interp *,arg1,argList);
+
+ va_start(argList, interp);
result = ObjPrintfVA(interp, argList);
va_end(argList);
return result;