1Tcl_WrongNumArgs(3)         Tcl Library Procedures         Tcl_WrongNumArgs(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_WrongNumArgs  - generate standard error message for wrong number of
9       arguments
10

SYNOPSIS

12       #include <tcl.h>
13
14       Tcl_WrongNumArgs(interp, objc, objv, message)
15

ARGUMENTS

17       Tcl_Interp interp (in)                Interpreter in which  error  will
18                                             be  reported:  error message gets
19                                             stored in its result value.
20
21       int objc (in)                         Number of leading arguments  from
22                                             objv to include in error message.
23
24       Tcl_Obj *const objv[] (in)            Arguments to command that had the
25                                             wrong number of arguments.
26
27       const char *message (in)              Additional error  information  to
28                                             print   after  leading  arguments
29                                             from objv.  This typically  gives
30                                             the acceptable syntax of the com‐
31                                             mand.  This argument may be NULL.
32______________________________________________________________________________
33

DESCRIPTION

35       Tcl_WrongNumArgs is a utility procedure that is invoked by command pro‐
36       cedures  when they discover that they have received the wrong number of
37       arguments.  Tcl_WrongNumArgs generates a  standard  error  message  and
38       stores it in the result value of interp.  The message includes the objc
39       initial elements of objv plus message.  For example, if  objv  consists
40       of  the  values foo and bar, objc is 1, and message is “fileName count
41       then interp's result value will be set to the following string:
42
43              wrong # args: should be "foo fileName count"
44
45       If objc is 2, the result will be set to the following string:
46
47              wrong # args: should be "foo bar fileName count"
48
49       Objc is usually 1, but may be 2 or more for commands  like  string  and
50       the Tk widget commands, which use the first argument as a subcommand.
51
52       Some of the values in the objv array may be abbreviations for a subcom‐
53       mand.  The command Tcl_GetIndexFromObj  will  convert  the  abbreviated
54       string value into an indexObject.  If an error occurs in the parsing of
55       the subcommand we would like to use the  full  subcommand  name  rather
56       than  the  abbreviation.   If  the  Tcl_WrongNumArgs  command finds any
57       indexObjects in the objv array it will use the full subcommand name  in
58       the  error  message instead of the abbreviated name that was originally
59       passed in.  Using the above example, let us assume that bar is actually
60       an  abbreviation for barfly and the value is now an indexObject because
61       it was passed to Tcl_GetIndexFromObj.  In this case the  error  message
62       would be:
63
64              wrong # args: should be "foo barfly fileName count"
65

SEE ALSO

67       Tcl_GetIndexFromObj(3)
68

KEYWORDS

70       command, error message, wrong number of arguments
71
72
73
74Tcl                                   8.0                  Tcl_WrongNumArgs(3)
Impressum