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

//initalize the package in the tcl interpreter, create tcl commands
int Tclservices_Init (Tcl_Interp *interp) {

  //set up an autorelease pool
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

  if (Tcl_InitStubs(interp, "8.5", 0) == NULL) {
    return TCL_ERROR;  
  }
  if (Tk_InitStubs(interp, "8.5", 0) == NULL) {
    return TCL_ERROR;
  }


  Tcl_CreateObjCommand(interp, "::tclservices::registerservicewidget", RegisterServiceWidget,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
 

  //initialize instance of TclServices to provide service functionality
  TclService *service = [[TclService alloc] init];
  myInterp = interp;
  [NSApp setServicesProvider:service];


  if (Tcl_PkgProvide(interp, "tclservices", "1.0") != TCL_OK) {
    return TCL_ERROR;
  }

  [pool release];
      
  return TCL_OK;
	
}