📄 wrongnumargs.3
字号:
'\"'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) @(#) WrongNumArgs.3 1.5 97/07/30 16:20:07'\" .so man.macros.TH Tcl_WrongNumArgs 3 8.0 Tcl "Tcl Library Procedures".BS.SH NAMETcl_WrongNumArgs \- generate standard error message for wrong number of arguments.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.sp\fBTcl_WrongNumArgs\fR(\fIinterp, objc, objv, message\fR).SH ARGUMENTS.AS Tcl_Interp "*CONST objv[]".AP Tcl_Interp interp inInterpreter in which error will be reported: error message gets storedin its result object..AP int objc inNumber of leading arguments from \fIobjv\fR to include in errormessage..TPTcl_Obj *CONST \fIobjv\fR[] (in)Arguments to command that had the wrong number of arguments..AP char *message inAdditional error information to print after leading argumentsfrom \fIobjv\fR. This typically gives the acceptable syntaxof the command. This argument may be NULL..BE.SH DESCRIPTION.PP\fBTcl_WrongNumArgs\fR is a utility procedure that is invoked bycommand procedures when they discover that they have received thewrong number of arguments. \fBTcl_WrongNumArgs\fR generates astandard error message and stores it in the result object of\fIinterp\fR. The message includes the \fIobjc\fR initialelements of \fIobjv\fR plus \fImessage\fR. For example, if\fIobjv\fR consists of the values \fBfoo\fR and \fBbar\fR,\fIobjc\fR is 1, and \fImessage\fR is ``\fBfileName count\fR''then \fIinterp\fR's result object will be set to the followingstring:.CSwrong # args: should be "foo fileName count".CEIf \fIobjc\fR is 2, the result will be set to the following string:.CSwrong # args: should be "foo bar fileName count".CE\fIObjc\fR is usually 1, but may be 2 or more for commands like\fBstring\fR and the Tk widget commands, which use the first argumentas a subcommand. .PPSome of the objects in the \fIobjv\fR array may be abbreviations fora subcommand. The command\fBTcl_GetIndexFromObj\fR will convert the abbreviated string objectinto an \fIindexObject\fR. If an error occurs in the parsing of thesubcommand we would like to use the full subcommand name rather thanthe abbreviation. If the \fBTcl_WrongNumArgs\fR command finds any\fIindexObjects\fR in the \fIobjv\fR array it will use the full subcommandname in the error message instead of the abbreviated name that wasorigionally passed in. Using the above example, lets assume that\fIbar\fR is actually an abbreviation for \fIbarfly\fR and the objectis now an indexObject becasue it was passed to\fBTcl_GetIndexFromObj\fR. In this case the error message would be:.CSwrong # args: should be "foo barfly fileName count".CE.SH "SEE ALSO"Tcl_GetIndexFromObj.SH KEYWORDScommand, error message, wrong number of arguments
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -