Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/doc/WrongNumArgs.3 @ 44

Last change on this file since 44 was 25, checked in by landauf, 18 years ago

added tcl to libs

File size: 2.9 KB
Line 
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
13Tcl_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
22Interpreter in which error will be reported: error message gets stored
23in its result object.
24.AP int objc in
25Number of leading arguments from \fIobjv\fR to include in error
26message.
27.AP "Tcl_Obj *const" objv[] in
28Arguments to command that had the wrong number of arguments.
29.AP "const char" *message in
30Additional error information to print after leading arguments
31from \fIobjv\fR.  This typically gives the acceptable syntax
32of 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
38command procedures when they discover that they have received the
39wrong number of arguments.  \fBTcl_WrongNumArgs\fR generates a
40standard error message and stores it in the result object of
41\fIinterp\fR.  The message includes the \fIobjc\fR initial
42elements 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"
46then \fIinterp\fR's result object will be set to the following
47string:
48.CS
49wrong # args: should be "foo fileName count"
50.CE
51If \fIobjc\fR is 2, the result will be set to the following string:
52.CS
53wrong # 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
57as a subcommand. 
58.PP
59Some of the objects in the \fIobjv\fR array may be abbreviations for
60a subcommand.  The command
61\fBTcl_GetIndexFromObj\fR will convert the abbreviated string object
62into an \fIindexObject\fR.  If an error occurs in the parsing of the
63subcommand we would like to use the full subcommand name rather than
64the abbreviation.  If the \fBTcl_WrongNumArgs\fR command finds any
65\fIindexObjects\fR in the \fIobjv\fR array it will use the full subcommand
66name in the error message instead of the abbreviated name that was
67originally passed in.  Using the above example, let us assume that
68\fIbar\fR is actually an abbreviation for \fIbarfly\fR and the object
69is now an indexObject because it was passed to
70\fBTcl_GetIndexFromObj\fR.  In this case the error message would be:
71.CS
72wrong # args: should be "foo barfly fileName count"
73.CE
74
75.SH "SEE ALSO"
76Tcl_GetIndexFromObj
77
78.SH KEYWORDS
79command, error message, wrong number of arguments
Note: See TracBrowser for help on using the repository browser.