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 object.
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
34

DESCRIPTION

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

SEE ALSO

64       Tcl_GetIndexFromObj
65
66

KEYWORDS

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