search for: tcl_newstringobj

Displaying 10 results from an estimated 10 matches for "tcl_newstringobj".

2018 Jul 01
2
[PATCH nbdkit] Add Tcl plugin, for writing plugins in Tcl.
...oad (void) +{ + if (interp) + Tcl_DeleteInterp (interp); + Tcl_Finalize (); +} + +/* Test if proc was defined by the Tcl code. */ +static int +proc_defined (const char *name) +{ + int r; + Tcl_Obj *cmd; + + cmd = Tcl_NewObj (); + Tcl_IncrRefCount (cmd); + Tcl_ListObjAppendElement (0, cmd, Tcl_NewStringObj ("info", -1)); + Tcl_ListObjAppendElement (0, cmd, Tcl_NewStringObj ("procs", -1)); + Tcl_ListObjAppendElement (0, cmd, Tcl_NewStringObj (name, -1)); + r = Tcl_EvalObjEx (interp, cmd, TCL_EVAL_DIRECT); + Tcl_DecrRefCount (cmd); + if (r != TCL_OK) { + nbdkit_error ("...
2020 Jun 07
5
use of the tcltk package crashes R 4.0.1 for Windows
...har *s; char *tmp; if (!isNull(nm) && strlen(s = translateChar(STRING_ELT(nm, i)))){ // tmp = calloc(strlen(s)+2, sizeof(char)); tmp = Calloc(strlen(s)+2, char); *tmp = '-'; strcpy(tmp+1, s); objv[objc++] = Tcl_NewStringObj(tmp, -1); free(tmp); } if (!isNull(t = VECTOR_ELT(avec, i))) objv[objc++] = (Tcl_Obj *) R_ExternalPtrAddr(t); } and I can't see how tmp can be NULL at the free(), nor can I see it mattering if it is not set to NULL (notice that it goes out of scope w...
2020 Jun 07
3
[External] Re: use of the tcltk package crashes R 4.0.1 for Windows
...l(nm) && strlen(s = translateChar(STRING_ELT(nm, i)))){ > > // tmp = calloc(strlen(s)+2, sizeof(char)); > > tmp = Calloc(strlen(s)+2, char); > > *tmp = '-'; > > strcpy(tmp+1, s); > > objv[objc++] = Tcl_NewStringObj(tmp, -1); > > free(tmp); > > } > > if (!isNull(t = VECTOR_ELT(avec, i))) > > objv[objc++] = (Tcl_Obj *) R_ExternalPtrAddr(t); > > } > > > > and I can't see how tmp can be NULL at the free(), nor can I see it matter...
2011 Feb 08
1
Compiling a Tcl extension for an R package
...X? (i.e. writing a configure script with the correct compile commands). Thanks, Adrian Waddell ########################### C Code (save as hello.c): #include <tcl.h> static int Hello_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Hello, World!", -1)); return TCL_OK; } int DLLEXPORT Hello_Init(Tcl_Interp *interp) { Tcl_CreateObjCommand(interp, "hello", Hello_Cmd, NULL, NULL); return TCL_OK; } which can be compiled (under Ubuntu 10.04) with: gcc -shared -o hello.so -DUSE_TCL_STUBS -I/usr/include/tc...
2020 Jun 07
4
[External] Re: use of the tcltk package crashes R 4.0.1 for Windows
...anslateChar(STRING_ELT(nm, i)))){ >>>> // tmp = calloc(strlen(s)+2, sizeof(char)); >>>> tmp = Calloc(strlen(s)+2, char); >>>> *tmp = '-'; >>>> strcpy(tmp+1, s); >>>> objv[objc++] = Tcl_NewStringObj(tmp, -1); >>>> free(tmp); >>>> } >>>> if (!isNull(t = VECTOR_ELT(avec, i))) >>>> objv[objc++] = (Tcl_Obj *) R_ExternalPtrAddr(t); >>>> } >>>> >>>> and I can't see how tmp can be...
2020 Jun 07
0
[External] Re: use of the tcltk package crashes R 4.0.1 for Windows
...;& strlen(s = translateChar(STRING_ELT(nm, i)))){ >>> // tmp = calloc(strlen(s)+2, sizeof(char)); >>> tmp = Calloc(strlen(s)+2, char); >>> *tmp = '-'; >>> strcpy(tmp+1, s); >>> objv[objc++] = Tcl_NewStringObj(tmp, -1); >>> free(tmp); >>> } >>> if (!isNull(t = VECTOR_ELT(avec, i))) >>> objv[objc++] = (Tcl_Obj *) R_ExternalPtrAddr(t); >>> } >>> >>> and I can't see how tmp can be NULL at the free(), nor ca...
2020 Jun 07
0
[External] Re: use of the tcltk package crashes R 4.0.1 for Windows
...p; > if (!isNull(nm) && strlen(s = translateChar(STRING_ELT(nm, i)))){ > // tmp = calloc(strlen(s)+2, sizeof(char)); > tmp = Calloc(strlen(s)+2, char); > *tmp = '-'; > strcpy(tmp+1, s); > objv[objc++] = Tcl_NewStringObj(tmp, -1); > free(tmp); > } > if (!isNull(t = VECTOR_ELT(avec, i))) > objv[objc++] = (Tcl_Obj *) R_ExternalPtrAddr(t); > } > > and I can't see how tmp can be NULL at the free(), nor can I see it mattering if it is not set to NULL (notic...
2020 Jun 07
0
[External] use of the tcltk package crashes R 4.0.1 for Windows
...ING_ELT(nm, i)))){ >>>>> // tmp = calloc(strlen(s)+2, sizeof(char)); >>>>> tmp = Calloc(strlen(s)+2, char); >>>>> *tmp = '-'; >>>>> strcpy(tmp+1, s); >>>>> objv[objc++] = Tcl_NewStringObj(tmp, -1); >>>>> free(tmp); >>>>> } >>>>> if (!isNull(t = VECTOR_ELT(avec, i))) >>>>> objv[objc++] = (Tcl_Obj *) R_ExternalPtrAddr(t); >>>>> } >>>>> >>>>> and I can&...
2020 Jun 07
2
[External] Re: use of the tcltk package crashes R 4.0.1 for Windows
...l(nm) && strlen(s = translateChar(STRING_ELT(nm, i)))){ > > // tmp = calloc(strlen(s)+2, sizeof(char)); > > tmp = Calloc(strlen(s)+2, char); > > *tmp = '-'; > > strcpy(tmp+1, s); > > objv[objc++] = Tcl_NewStringObj(tmp, -1); > > free(tmp); > > } > > if (!isNull(t = VECTOR_ELT(avec, i))) > > objv[objc++] = (Tcl_Obj *) R_ExternalPtrAddr(t); > > } > > > > and I can't see how tmp can be NULL at the free(), nor can I see it > m...
2020 Jun 07
7
use of the tcltk package crashes R 4.0.1 for Windows
Hi, The following code, from the examples in ?TkWidgets , immediately crashes R 4.0.1 for Windows: --------------------- snip -------------------- library("tcltk") tt <- tktoplevel() label.widget <- tklabel(tt, text = "Hello, World!") button.widget <- tkbutton(tt, text = "Push", command = function()cat("OW!\n")) tkpack(label.widget,