OSDN Git Service

Initial revision
authorkseitz <kseitz>
Tue, 22 Jul 2008 20:40:18 +0000 (20:40 +0000)
committerkseitz <kseitz>
Tue, 22 Jul 2008 20:40:18 +0000 (20:40 +0000)
itcl/itcl/doc/RegisterC.3 [new file with mode: 0644]
itcl/itcl/doc/Stack.3 [new file with mode: 0644]
itcl/itcl/doc/is.n [new file with mode: 0644]

diff --git a/itcl/itcl/doc/RegisterC.3 b/itcl/itcl/doc/RegisterC.3
new file mode 100644 (file)
index 0000000..c1e180c
--- /dev/null
@@ -0,0 +1,124 @@
+'\"
+'\" Copyright (c) 1993-1998  Lucent Technologies, Inc.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+'\" RCS: $Id$
+'\"
+.so man.macros
+.TH Itcl_RegisterC 3 3.0 itcl "[incr\ Tcl] Library Procedures"
+.BS
+'\" Note:  do not modify the .SH NAME line immediately below!
+.SH NAME
+Itcl_RegisterC, Itcl_RegisterObjC, Itcl_FindC \- Associate a symbolic name with a C procedure.
+.SH SYNOPSIS
+.nf
+\fB#include <itcl.h>\fR
+.sp
+int
+\fBItcl_RegisterC\fR(\fIinterp, cmdName, argProc, clientData, deleteProc\fR)
+.sp
+int
+\fBItcl_RegisterObjC\fR(\fIinterp, cmdName, objProc, clientData, deleteProc\fR)
+.sp
+int
+\fBItcl_FindC\fR(\fIinterp, cmdName, argProcPtr, objProcPtr, cDataPtr\fR)
+.SH ARGUMENTS
+.AP Tcl_Interp *interp in
+Interpreter in which to create new command.
+.VS 8.4
+.AP "CONST char" *cmdName in
+.VE
+Name of command.
+.AP Tcl_CmdProc *argProc in
+Implementation of new command:  \fIargProc\fR will be called whenever
+.AP Tcl_CmdProc **argProcPtr in/out
+The Tcl_CmdProc * to receive the pointer.
+.AP Tcl_ObjCmdProc *objProc in
+Implementation of the new command: \fIobjProc\fR will be called whenever
+.AP Tcl_ObjCmdProc **objProcPtr in/out
+The Tcl_ObjCmdProc * to receive the pointer.
+.AP ClientData clientData in
+Arbitrary one-word value to pass to \fIproc\fR and \fIdeleteProc\fR.
+.AP ClientData *cDataPtr in/out
+The ClientData to receive the pointer.
+.AP Tcl_CmdDeleteProc *deleteProc in
+Procedure to call before \fIcmdName\fR is deleted from the interpreter;
+allows for command-specific cleanup.  If NULL, then no procedure is
+called before the command is deleted.
+.BE
+
+.SH DESCRIPTION
+.PP
+Used to associate a symbolic name with an (argc,argv) C procedure
+that handles a Tcl command.  Procedures that are registered in this
+manner can be referenced in the body of an [incr Tcl] class
+definition to specify C procedures to acting as methods/procs.
+Usually invoked in an initialization routine for an extension,
+called out in Tcl_AppInit() at the start of an application.
+.PP
+Each symbolic procedure can have an arbitrary client data value
+associated with it.  This value is passed into the command
+handler whenever it is invoked.
+.PP
+A symbolic procedure name can be used only once for a given style
+(arg/obj) handler.  If the name is defined with an arg-style
+handler, it can be redefined with an obj-style handler; or if
+the name is defined with an obj-style handler, it can be redefined
+with an arg-style handler.  In either case, any previous client
+data is discarded and the new client data is remembered.  However,
+if a name is redefined to a different handler of the same style,
+this procedure returns an error.
+.PP
+Returns TCL_OK on success, or TCL_ERROR (along with an error message
+in interp->result) if anything goes wrong.
+.PP
+C procedures can be integrated into an \fB[incr\ Tcl]\fR class
+definition to implement methods, procs, and the "config" code
+for public variables.  Any body that starts with "\fB@\fR"
+is treated as the symbolic name for a C procedure.
+.PP
+Symbolic names are established by registering procedures via
+\fBItcl_RegisterC()\fR.  This is usually done in the \fBTcl_AppInit()\fR
+procedure, which is automatically called when the interpreter starts up.
+In the following example, the procedure \fCMy_FooCmd()\fR is registered
+with the symbolic name "foo".  This procedure can be referenced in
+the \fBbody\fR command as "\fC@foo\fR".
+.CS
+int
+Tcl_AppInit(interp)
+    Tcl_Interp *interp;     /* Interpreter for application. */
+{
+    if (Itcl_Init(interp) == TCL_ERROR) {
+        return TCL_ERROR;
+    }
+
+    if (Itcl_RegisterC(interp, "foo", My_FooCmd) != TCL_OK) {
+        return TCL_ERROR;
+    }
+}
+.CE
+C procedures are implemented just like ordinary Tcl commands.
+See the \fBCrtCommand\fR man page for details.  Within the procedure,
+class data members can be accessed like ordinary variables
+using \fBTcl_SetVar()\fR, \fBTcl_GetVar()\fR, \fBTcl_TraceVar()\fR,
+etc.  Class methods and procs can be executed like ordinary commands
+using \fBTcl_Eval()\fR.  \fB[incr\ Tcl]\fR makes this possible by
+automatically setting up the context before executing the C procedure.
+.PP
+This scheme provides a natural migration path for code development.
+Classes can be developed quickly using Tcl code to implement the
+bodies.  An entire application can be built and tested.  When
+necessary, individual bodies can be implemented with C code to
+improve performance.
+.PP
+See the Archetype class in \fB[incr\ Tk]\fR for an example of how this
+C linking method is used.
+
+.SH "SEE ALSO"
+Tcl_CreateCommand, Tcl_CreateObjCommand
+
+.SH KEYWORDS
+class, object
+
diff --git a/itcl/itcl/doc/Stack.3 b/itcl/itcl/doc/Stack.3
new file mode 100644 (file)
index 0000000..e5ce210
--- /dev/null
@@ -0,0 +1,60 @@
+'\"
+'\" Copyright (c) 1993-1998  Lucent Technologies, Inc.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+'\" RCS: $Id$
+'\"
+.so man.macros
+.TH Itcl_InitStack 3 3.0 itcl "[incr\ Tcl] Library Procedures"
+.BS
+'\" Note:  do not modify the .SH NAME line immediately below!
+.SH NAME
+Itcl_InitStack, Itcl_DeleteStack, Itcl_PushStack, Itcl_PopStack, Itcl_PeekStack, Itcl_GetStackValue, Itcl_GetStackSize \- Manipulate an Itcl stack object.
+.SH SYNOPSIS
+.nf
+\fB#include <itcl.h>\fR
+.sp
+int
+\fBItcl_InitStack\fR(\fIstack\fR)
+.sp
+int
+\fBItcl_DeleteStack\fR(\fIstack\fR)
+.sp
+int
+\fBItcl_PushStack\fR(\fIcdata, stack\fR)
+.sp
+ClientData
+\fBItcl_PopStack\fR(\fIstack\fR)
+.sp
+ClientData
+\fBItcl_PeekStack\fR(\fIstack\fR)
+.sp
+ClientData
+\fBItcl_GetStackValue\fR(\fIstack, pos\fR)
+.sp
+int
+\fBItcl_GetStackSize\fR(\fIstack\fR)
+.SH ARGUMENTS
+.AP Itcl_Stack *stack in
+Stack info structure.
+.AP int pos in
+position in stack order from the top.
+.AP ClientData clientData in
+Arbitrary one-word value to save in the stack.
+.BE
+
+.SH DESCRIPTION
+.PP
+\fBItcl_InitStack\fR initializes a stack structure and \fBItcl_DeleteStack\fR
+deletes it. \fBItcl_PushStack\fR pushes the \fIcdata\fR value onto the stack.
+\fBItcl_PopStack\fR removes and returns the top most \fIcdata\fR value.
+\fBItcl_PeekStack\fR returns the top most value, but does not remove it.
+\fBItcl_GetStackValue\fR gets a value at some index within the stack.  Index
+"0" is the first value pushed onto the stack. \fBItcl_GetStackSize\fR
+returns the count of entries on the stack.
+
+.SH KEYWORDS
+stack
+
diff --git a/itcl/itcl/doc/is.n b/itcl/itcl/doc/is.n
new file mode 100644 (file)
index 0000000..c53bcc9
--- /dev/null
@@ -0,0 +1,66 @@
+'\"
+'\" Copyright (c) 1993-1998  Lucent Technologies, Inc.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+'\" RCS: $Id$
+'\"
+.so man.macros
+.TH is n 3.3 itcl "[incr\ Tcl]"
+.BS
+'\" Note:  do not modify the .SH NAME line immediately below!
+.SH NAME
+is \- test argument to see if it is a class or an object
+.SH SYNOPSIS
+\fBitcl::is \fIoption\fR ?\fIarg arg ...\fR?
+.BE
+
+.SH DESCRIPTION
+.PP
+The \fBis\fR command is used to check if the argument given is
+a class or an object; depending on the option given. If the argument
+if a class or object, then 1 is returned. Otherwise, 0 is returned.
+The \fBis\fR command also recognizes the commands wrapped in the
+itcl \fBcode command.
+.PP
+The \fIoption\fR argument determines what action is carried out
+by the command.  The legal \fIoptions\fR (which may be abbreviated)
+are:
+.TP
+\fBis class \fIcommand\fR
+Returns 1 if command is a class, and returns 0 otherwise.
+.sp
+The fully qualified name of the class needs to be given as the \fIcommand\fR
+argument. So, if a class resides in a namespace, then the namespace needs to
+be specified as well. So, if a class \fBC resides in a namespace \fBN, then 
+the command should be called like:
+.CS
+\fBis N::C\fR
+    or
+\fBis ::N::C\fR
+.CE
+.TP
+\fBis\fR object ?\fB-class \fIclassName\fR? \fIcommand\fR
+Returns 1 if \fIcommand\fR is an object, and returns 0 otherwise.
+.sp
+If the optional "\fB-class\fR" parameter is specified, then the
+\fIcommand\fR will be checked within the context of the class
+given. Note that \fIclassName\fR has to exist. If not, then an
+error will be given. So, if \fIclassName\fR is uncertain to be
+a class, then the programmer will need to check it's existance
+beforehand, or wrap it in a catch statement.
+.sp
+So, if \fBc\fR is an object in the class \fBC\fR, in namespace N then
+these are the possibilities (all return 1):
+.CS
+set obj [N::C c]
+itcl::is object N::c
+itcl::is object c
+itcl::is object $obj
+itcl::is object [itcl::code c]
+.CE
+
+.SH KEYWORDS
+class, object
+