diff options
Diffstat (limited to 'doc/CrtCommand.3')
-rw-r--r-- | doc/CrtCommand.3 | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/doc/CrtCommand.3 b/doc/CrtCommand.3 index da0da22..fcc04d5 100644 --- a/doc/CrtCommand.3 +++ b/doc/CrtCommand.3 @@ -17,12 +17,10 @@ Tcl_CreateCommand \- implement new commands in C Tcl_Command \fBTcl_CreateCommand\fR(\fIinterp, cmdName, proc, clientData, deleteProc\fR) .SH ARGUMENTS -.AS Tcl_CmdDeleteProc **deleteProcPtr +.AS Tcl_CmdDeleteProc *deleteProc .AP Tcl_Interp *interp in Interpreter in which to create new command. -.VS 8.4 -.AP "CONST char" *cmdName in -.VE +.AP "const char" *cmdName in Name of command. .AP Tcl_CmdProc *proc in Implementation of new command: \fIproc\fR will be called whenever @@ -79,10 +77,10 @@ and it returns NULL. \fBTcl_CmdProc\fR: .CS typedef int Tcl_CmdProc( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - int \fIargc\fR, - CONST char *\fIargv\fR[]); + ClientData \fIclientData\fR, + Tcl_Interp *\fIinterp\fR, + int \fIargc\fR, + const char *\fIargv\fR[]); .CE When \fIproc\fR is invoked the \fIclientData\fR and \fIinterp\fR parameters will be copies of the \fIclientData\fR and \fIinterp\fR @@ -95,26 +93,23 @@ the command name) and \fIargv\fR giving the values of the arguments as strings. The \fIargv\fR array will contain \fIargc\fR+1 values; the first \fIargc\fR values point to the argument strings, and the last value is NULL. -.VS Note that the argument strings should not be modified as they may point to constant strings or may be shared with other parts of the interpreter. -.VE .PP -.VS Note that the argument strings are encoded in normalized UTF-8 since version 8.1 of Tcl. -.VE .PP -\fIProc\fR must return an integer code that is either \fBTCL_OK\fR, \fBTCL_ERROR\fR, -\fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR. See the Tcl overview man page +\fIProc\fR must return an integer code that is expected to be one of +\fBTCL_OK\fR, \fBTCL_ERROR\fR, \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or +\fBTCL_CONTINUE\fR. See the Tcl overview man page for details on what these codes mean. Most normal commands will only return \fBTCL_OK\fR or \fBTCL_ERROR\fR. In addition, \fIproc\fR must set the interpreter result to point to a string value; in the case of a \fBTCL_OK\fR return code this gives the result of the command, and in the case of \fBTCL_ERROR\fR it gives an error message. The \fBTcl_SetResult\fR procedure provides an easy interface for setting -the return value; for complete details on how the the interpreter result +the return value; for complete details on how the interpreter result field is managed, see the \fBTcl_Interp\fR man page. Before invoking a command procedure, \fBTcl_Eval\fR sets the interpreter result to point to an empty string, @@ -135,11 +130,11 @@ application an opportunity to release any structures associated with the command. \fIDeleteProc\fR should have arguments and result that match the type \fBTcl_CmdDeleteProc\fR: .CS -typedef void Tcl_CmdDeleteProc(ClientData \fIclientData\fR); +typedef void Tcl_CmdDeleteProc( + ClientData \fIclientData\fR); .CE The \fIclientData\fR argument will be the same as the \fIclientData\fR argument passed to \fBTcl_CreateCommand\fR. -.PP .SH "SEE ALSO" Tcl_CreateObjCommand, Tcl_DeleteCommand, Tcl_GetCommandInfo, Tcl_SetCommandInfo, Tcl_GetCommandName, Tcl_SetObjResult |