#include #include #include #include #include //#include // cdev includes #include #include #include #include #include #include typedef cdevRequestObject *cdevRequestObjectPtr; int TcltestCmd(ClientData, Tcl_Interp *interp, int argc, char **argv) { char **devices = NULL; int i, n, ndevices; Tcl_DString ds; cdevData result; cdevCallback *cb = NULL; cdevRequestObjectPtr request, *requests; int delinfo = 0; void *handle; printf("TcltestCmd: \n"); handle = dlopen ("/home/pss060/sls/hunt/cdev-1.6/lib/linux/1.6/caService.so", RTLD_LAZY); if (!handle) { fputs (dlerror(), stderr); exit(1); } /* printf("TcltestCmd: ndevices=1 argv[1]= %s argv[2]=%s\n",argv[1],argv[2]); request = cdevRequestObject::attachPtr(argv[1], argv[2]); return TCL_OK; // free((char*)devices); printf("have got request object\n"); // send it sync if(request->send(NULL, result) != CDEV_SUCCESS) { sprintf(interp->result, "error in send: %s %s", argv[1], argv[2]); return TCL_ERROR; } else { result.asciiDump(stdout); } */ return TCL_OK; } extern"C"int Tcltest_Init(Tcl_Interp *interp) { printf("This is Tcltest_Init \n"); if(Tcl_PkgProvide(interp, "Tcltest", TCLCDEV_VERSION) != TCL_OK) { return TCL_ERROR; } Tcl_CreateCommand(interp,"tcltest", TcltestCmd, (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL); printf("end of Tcltest_Init \n"); return TCL_OK; }