Posted to tcl by kevin_walzer at Mon Mar 05 03:55:26 GMT 2018view raw

  1. //initalize the package in the tcl interpreter, create tcl commands
  2. int Tclservices_Init (Tcl_Interp *interp) {
  3.  
  4. //set up an autorelease pool
  5. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  6.  
  7. if (Tcl_InitStubs(interp, "8.5", 0) == NULL) {
  8. return TCL_ERROR;
  9. }
  10. if (Tk_InitStubs(interp, "8.5", 0) == NULL) {
  11. return TCL_ERROR;
  12. }
  13.  
  14.  
  15. Tcl_CreateObjCommand(interp, "::tclservices::registerservicewidget", RegisterServiceWidget,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  16.  
  17.  
  18. //initialize instance of TclServices to provide service functionality
  19. TclService *service = [[TclService alloc] init];
  20. myInterp = interp;
  21. [NSApp setServicesProvider:service];
  22.  
  23.  
  24. if (Tcl_PkgProvide(interp, "tclservices", "1.0") != TCL_OK) {
  25. return TCL_ERROR;
  26. }
  27.  
  28. [pool release];
  29.  
  30. return TCL_OK;
  31.  
  32. }