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 mes‐
23                                              sage.
24
25       Tcl_Obj      *CONST objv[]   (in)      Arguments to  command  that  had
26                                              the wrong number of arguments.
27
28       CONST char   *message        (in)      Additional  error information to
29                                              print  after  leading  arguments
30                                              from objv.  This typically gives
31                                              the  acceptable  syntax  of  the
32                                              command.   This  argument may be
33                                              NULL.
34_________________________________________________________________
35
36

DESCRIPTION

38       Tcl_WrongNumArgs is a utility procedure that is invoked by command pro‐
39       cedures  when they discover that they have received the wrong number of
40       arguments.  Tcl_WrongNumArgs generates a  standard  error  message  and
41       stores  it  in  the  result object of interp.  The message includes the
42       objc initial elements of objv plus message.  For example, if objv  con‐
43       sists  of  the values foo and bar, objc is 1, and message is ``fileName
44       count'' then interp's result  object  will  be  set  to  the  following
45       string:
46              wrong # args: should be "foo fileName count"
47       If objc is 2, the result will be set to the following string:
48              wrong # args: should be "foo bar fileName count"
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 objects in the objv array may be abbreviations for  a  sub‐
53       command.   The command Tcl_GetIndexFromObj will convert the abbreviated
54       string object into an indexObject.  If an error occurs in  the  parsing
55       of  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, lets assume that bar is actually
60       an abbreviation for barfly and the object is now an indexObject because
61       it  was  passed to Tcl_GetIndexFromObj.  In this case the error message
62       would be:
63              wrong # args: should be "foo barfly fileName count"
64
65

SEE ALSO

67       Tcl_GetIndexFromObj
68
69

KEYWORDS

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