item2
Next»

contents

 

Introduction - 1

History - 2

Overview - 3

Advanced features - 4

Work in progress - 5

One possibility - 6

Conclusion - 7

 

References

Appendix 1 - blowfish

Appendix 2 - tkspline

4.5 - Lower Level Stuff

Critcl::cproc arguments and return values must be typed. There are no default arguments or ways to pass more sophisticated data items than int/long/float/double /char*.  The return type can be "string", meaning that it is a Tcl_Alloc'ed char* which will be Tcl_Free'd at some point.

You can, however,  use Tcl_Obj* arguments  (with no refcount change), or return it (in which case it will be decref'ed).  If the first parameter to critcl::cproc has type Tcl_Interp* that will be passed in.  Lastly, if the return type is ok, then an integer return code of type TCL_OK or TCL_ERROR is expected and will be processed as usual (errors must set the result, so it is most likely that you'll also want to specify the Tcl_Interp* argument).

The critcl::cdata procedure can be used to create a Tcl byte array object, and associated Tcl command:

   critcl::cdata hi ‚Äúhi there!‚Äù

   % hi
   hi there!

When using critcl::ccommand (for example, to invoke existing C functions in a library) it is possible to specify the clientdata and delproc arguments to the  generated Tcl_CreateObjCommand function. To do this, use the optional  -clientdata and/or -delproc before the argument specifying the C code.

For example,  the following is from the Critcl wrapping of the BLT busy widget:

   critcl::ccommand release \
            {data ip objc objv} \
            -clientdata BusyDataPtr {
      int argc = objc;
      char **argv = obj_convert(objc, objv);
      ThreadData *dataPtr =  \
           (ThreadData *) data;
      Busy *busyPtr;
      int i;

      for (i = 1; i < argc; i++) {
           if (GetBusy(dataPtr, ip, argv[i],\
               &busyPtr) != TCL_OK) {
               return TCL_ERROR;
           }
           HideBusyWindow(busyPtr);
            busyPtr->isBusy = FALSE;
        }
      Tcl_SetResult(ip, NULL, NULL);
      return TCL_OK;
   }

see also

Critcl Home Page

Tclkit Home Page

Starkit Home Page

Wikit Home Page

Tclers' Wiki

Steve's Website

Jean-Claude's Website

Paper by S. Landers & J.C. Wippler, as presented at Tcl/Tk 2002 conference - see also original PDF.

Papers & Presentations