1 |
578 |
markom |
'\"
|
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.1.1.1 2002-01-16 10:25:24 markom 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 \fR
|
17 |
|
|
.sp
|
18 |
|
|
\fBTcl_WrongNumArgs\fR(\fIinterp, objc, objv, message\fR)
|
19 |
|
|
.SH ARGUMENTS
|
20 |
|
|
.AS Tcl_Interp "*CONST objv[]"
|
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 |
|
|
.TP
|
28 |
|
|
Tcl_Obj *CONST \fIobjv\fR[] (in)
|
29 |
|
|
Arguments to command that had the wrong number of arguments.
|
30 |
|
|
.AP char *message in
|
31 |
|
|
Additional error information to print after leading arguments
|
32 |
|
|
from \fIobjv\fR. This typically gives the acceptable syntax
|
33 |
|
|
of the command. This argument may be NULL.
|
34 |
|
|
.BE
|
35 |
|
|
|
36 |
|
|
.SH DESCRIPTION
|
37 |
|
|
.PP
|
38 |
|
|
\fBTcl_WrongNumArgs\fR is a utility procedure that is invoked by
|
39 |
|
|
command procedures when they discover that they have received the
|
40 |
|
|
wrong number of arguments. \fBTcl_WrongNumArgs\fR generates a
|
41 |
|
|
standard error message and stores it in the result object of
|
42 |
|
|
\fIinterp\fR. The message includes the \fIobjc\fR initial
|
43 |
|
|
elements of \fIobjv\fR plus \fImessage\fR. For example, if
|
44 |
|
|
\fIobjv\fR consists of the values \fBfoo\fR and \fBbar\fR,
|
45 |
|
|
\fIobjc\fR is 1, and \fImessage\fR is ``\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 |
|
|
origionally passed in. Using the above example, lets assume that
|
68 |
|
|
\fIbar\fR is actually an abbreviation for \fIbarfly\fR and the object
|
69 |
|
|
is now an indexObject becasue 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
|