| [25] | 1 | '\" | 
|---|
 | 2 | '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. | 
|---|
 | 3 | '\" | 
|---|
 | 4 | '\" See the file "license.terms" for information on usage and redistribution | 
|---|
 | 5 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | 
|---|
 | 6 | '\"  | 
|---|
 | 7 | '\" RCS: @(#) $Id: WrongNumArgs.3,v 1.12 2007/12/13 15:22:32 dgp Exp $ | 
|---|
 | 8 | '\"  | 
|---|
 | 9 | .so man.macros | 
|---|
 | 10 | .TH Tcl_WrongNumArgs 3 8.0 Tcl "Tcl Library Procedures" | 
|---|
 | 11 | .BS | 
|---|
 | 12 | .SH NAME | 
|---|
 | 13 | Tcl_WrongNumArgs \- generate standard error message for wrong number of arguments | 
|---|
 | 14 | .SH SYNOPSIS | 
|---|
 | 15 | .nf | 
|---|
 | 16 | \fB#include <tcl.h>\fR | 
|---|
 | 17 | .sp | 
|---|
 | 18 | \fBTcl_WrongNumArgs\fR(\fIinterp, objc, objv, message\fR) | 
|---|
 | 19 | .SH ARGUMENTS | 
|---|
 | 20 | .AS "Tcl_Obj *const" *message | 
|---|
 | 21 | .AP Tcl_Interp interp in | 
|---|
 | 22 | Interpreter in which error will be reported: error message gets stored | 
|---|
 | 23 | in its result object. | 
|---|
 | 24 | .AP int objc in | 
|---|
 | 25 | Number of leading arguments from \fIobjv\fR to include in error | 
|---|
 | 26 | message. | 
|---|
 | 27 | .AP "Tcl_Obj *const" objv[] in | 
|---|
 | 28 | Arguments to command that had the wrong number of arguments. | 
|---|
 | 29 | .AP "const char" *message in | 
|---|
 | 30 | Additional error information to print after leading arguments | 
|---|
 | 31 | from \fIobjv\fR.  This typically gives the acceptable syntax | 
|---|
 | 32 | of the command.  This argument may be NULL. | 
|---|
 | 33 | .BE | 
|---|
 | 34 |  | 
|---|
 | 35 | .SH DESCRIPTION | 
|---|
 | 36 | .PP | 
|---|
 | 37 | \fBTcl_WrongNumArgs\fR is a utility procedure that is invoked by | 
|---|
 | 38 | command procedures when they discover that they have received the | 
|---|
 | 39 | wrong number of arguments.  \fBTcl_WrongNumArgs\fR generates a | 
|---|
 | 40 | standard error message and stores it in the result object of | 
|---|
 | 41 | \fIinterp\fR.  The message includes the \fIobjc\fR initial | 
|---|
 | 42 | elements of \fIobjv\fR plus \fImessage\fR.  For example, if | 
|---|
 | 43 | \fIobjv\fR consists of the values \fBfoo\fR and \fBbar\fR, | 
|---|
 | 44 | \fIobjc\fR is 1, and \fImessage\fR is | 
|---|
 | 45 | .QW "\fBfileName count\fR" | 
|---|
 | 46 | then \fIinterp\fR's result object will be set to the following | 
|---|
 | 47 | string: | 
|---|
 | 48 | .CS | 
|---|
 | 49 | wrong # args: should be "foo fileName count" | 
|---|
 | 50 | .CE | 
|---|
 | 51 | If \fIobjc\fR is 2, the result will be set to the following string: | 
|---|
 | 52 | .CS | 
|---|
 | 53 | wrong # args: should be "foo bar fileName count" | 
|---|
 | 54 | .CE | 
|---|
 | 55 | \fIObjc\fR is usually 1, but may be 2 or more for commands like | 
|---|
 | 56 | \fBstring\fR and the Tk widget commands, which use the first argument | 
|---|
 | 57 | as a subcommand.   | 
|---|
 | 58 | .PP | 
|---|
 | 59 | Some of the objects in the \fIobjv\fR array may be abbreviations for | 
|---|
 | 60 | a subcommand.  The command | 
|---|
 | 61 | \fBTcl_GetIndexFromObj\fR will convert the abbreviated string object | 
|---|
 | 62 | into an \fIindexObject\fR.  If an error occurs in the parsing of the | 
|---|
 | 63 | subcommand we would like to use the full subcommand name rather than | 
|---|
 | 64 | the abbreviation.  If the \fBTcl_WrongNumArgs\fR command finds any | 
|---|
 | 65 | \fIindexObjects\fR in the \fIobjv\fR array it will use the full subcommand | 
|---|
 | 66 | name in the error message instead of the abbreviated name that was | 
|---|
 | 67 | originally passed in.  Using the above example, let us assume that | 
|---|
 | 68 | \fIbar\fR is actually an abbreviation for \fIbarfly\fR and the object | 
|---|
 | 69 | is now an indexObject because it was passed to | 
|---|
 | 70 | \fBTcl_GetIndexFromObj\fR.  In this case the error message would be: | 
|---|
 | 71 | .CS | 
|---|
 | 72 | wrong # args: should be "foo barfly fileName count" | 
|---|
 | 73 | .CE | 
|---|
 | 74 |  | 
|---|
 | 75 | .SH "SEE ALSO" | 
|---|
 | 76 | Tcl_GetIndexFromObj | 
|---|
 | 77 |  | 
|---|
 | 78 | .SH KEYWORDS | 
|---|
 | 79 | command, error message, wrong number of arguments | 
|---|