WrongNumArgs.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
- '"
- '" 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.
- '"
- '" RCS: @(#) $Id: WrongNumArgs.3,v 1.5 2002/07/01 18:24:39 jenglish Exp $
- '"
- .so man.macros
- .TH Tcl_WrongNumArgs 3 8.0 Tcl "Tcl Library Procedures"
- .BS
- .SH NAME
- Tcl_WrongNumArgs - generate standard error message for wrong number of arguments
- .SH SYNOPSIS
- .nf
- fB#include <tcl.h>fR
- .sp
- fBTcl_WrongNumArgsfR(fIinterp, objc, objv, messagefR)
- .SH ARGUMENTS
- .AS Tcl_Interp "*CONST objv[]"
- .AP Tcl_Interp interp in
- Interpreter in which error will be reported: error message gets stored
- in its result object.
- .AP int objc in
- Number of leading arguments from fIobjvfR to include in error
- message.
- .AP Tcl_Obj "*CONST objv[]" in
- Arguments to command that had the wrong number of arguments.
- .AP "CONST char" *message in
- Additional error information to print after leading arguments
- from fIobjvfR. This typically gives the acceptable syntax
- of the command. This argument may be NULL.
- .BE
- .SH DESCRIPTION
- .PP
- fBTcl_WrongNumArgsfR is a utility procedure that is invoked by
- command procedures when they discover that they have received the
- wrong number of arguments. fBTcl_WrongNumArgsfR generates a
- standard error message and stores it in the result object of
- fIinterpfR. The message includes the fIobjcfR initial
- elements of fIobjvfR plus fImessagefR. For example, if
- fIobjvfR consists of the values fBfoofR and fBbarfR,
- fIobjcfR is 1, and fImessagefR is ``fBfileName countfR''
- then fIinterpfR's result object will be set to the following
- string:
- .CS
- wrong # args: should be "foo fileName count"
- .CE
- If fIobjcfR is 2, the result will be set to the following string:
- .CS
- wrong # args: should be "foo bar fileName count"
- .CE
- fIObjcfR is usually 1, but may be 2 or more for commands like
- fBstringfR and the Tk widget commands, which use the first argument
- as a subcommand.
- .PP
- Some of the objects in the fIobjvfR array may be abbreviations for
- a subcommand. The command
- fBTcl_GetIndexFromObjfR will convert the abbreviated string object
- into an fIindexObjectfR. If an error occurs in the parsing of the
- subcommand we would like to use the full subcommand name rather than
- the abbreviation. If the fBTcl_WrongNumArgsfR command finds any
- fIindexObjectsfR in the fIobjvfR array it will use the full subcommand
- name in the error message instead of the abbreviated name that was
- originally passed in. Using the above example, lets assume that
- fIbarfR is actually an abbreviation for fIbarflyfR and the object
- is now an indexObject because it was passed to
- fBTcl_GetIndexFromObjfR. In this case the error message would be:
- .CS
- wrong # args: should be "foo barfly fileName count"
- .CE
- .SH "SEE ALSO"
- Tcl_GetIndexFromObj
- .SH KEYWORDS
- command, error message, wrong number of arguments