8 #define _RPMTCL_INTERNAL
26 Tcl_DeleteInterp((Tcl_Interp *)tcl->I);
42 if (_rpmtclPool ==
NULL) {
51 static int rpmtclIOclose(ClientData CD, Tcl_Interp *I)
55 fprintf(stderr,
"==> %s(%p, %p)\n", __FUNCTION__, CD, I);
59 static int rpmtclIOread(ClientData CD,
char *
b,
int nb,
int *errnop)
63 fprintf(stderr,
"==> %s(%p, %p[%d], %p)\n", __FUNCTION__, CD, b, nb, errnop);
68 static int rpmtclIOwrite(ClientData CD,
const char *b,
int nb,
int *errnop)
73 fprintf(stderr,
"==> %s(%p, %p[%d], %p)\n", __FUNCTION__, CD, b, nb, errnop);
84 static int rpmtclIOseek(ClientData CD,
long off,
int mode,
int *errnop)
88 fprintf(stderr,
"==> %s(%p, %ld, %d, %p)\n", __FUNCTION__, CD, off, mode, errnop);
93 static Tcl_ChannelType rpmtclIO = {
95 TCL_CHANNEL_VERSION_2,
110 #
if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 4
129 (flags & 0x80000000) ?
rpmtclI() :
133 #if defined(WITH_TCL)
134 static char * _av[] = {
"rpmtcl",
NULL };
135 Tcl_Interp * tclI = Tcl_CreateInterp();
139 if (av ==
NULL) av = _av;
142 Tcl_SetVar(tclI,
"argv", Tcl_Merge(ac-1, (
const char *
const *)av+1), TCL_GLOBAL_ONLY);
144 Tcl_SetVar(tclI,
"argc", b, TCL_GLOBAL_ONLY);
145 Tcl_SetVar(tclI,
"argv0", av[0], TCL_GLOBAL_ONLY);
146 Tcl_SetVar(tclI,
"tcl_interactive",
"0", TCL_GLOBAL_ONLY);
149 { Tcl_Channel tclout = Tcl_GetStdChannel(TCL_STDOUT);
150 Tcl_SetChannelOption(tclI, tclout,
"-translation",
"auto");
151 Tcl_StackChannel(tclI, &rpmtclIO, tcl, TCL_WRITABLE, tclout);
152 tcl->tclout = (
void *) tclout;
165 fprintf(stderr,
"==> %s(%p,%s)\n", __FUNCTION__, tcl, fn);
169 #if defined(WITH_TCL)
170 if (fn !=
NULL && Tcl_EvalFile((Tcl_Interp *)tcl->I, fn) == TCL_OK) {
184 fprintf(stderr,
"==> %s(%p,%s)\n", __FUNCTION__, tcl, str);
188 #if defined(WITH_TCL)
189 if (str !=
NULL && Tcl_Eval((Tcl_Interp *)tcl->I, str) == TCL_OK) {
rpmtcl rpmtclLink(rpmtcl tcl)
Reference a tcl interpreter instance.
static void rpmtclFini(void *_tcl)
static char *size_t nb
fgets(3) analogue that reads \ continuations.
rpmiob rpmiobFree(rpmiob iob)
Destroy a I/O buffer instance.
rpmiob rpmiobAppend(rpmiob iob, const char *s, size_t nl)
Append string to I/O buffer.
static PyObject *char * mode
sprintf(t," (%u)",(unsigned) dig->nbytes)
enum rpmRC_e rpmRC
RPM return codes.
rpmRC rpmtclRunFile(rpmtcl tcl, const char *fn, const char **resultp)
Execute tcl from a file.
static rpmtcl rpmtclI(void)
rpmioItem rpmioGetPool(rpmioPool pool, size_t size)
Get unused item from pool, or alloc a new item.
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
int argvCount(const ARGV_t argv)
Return no.
rpmiob rpmiobNew(size_t len)
Create an I/O buffer.
static const char *char c
Return text between pl and matching pr characters.
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
static rpmtcl rpmtclGetPool(rpmioPool pool)
rpmioPool rpmioNewPool(const char *name, size_t size, int limit, int flags, char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
Create a memory pool.
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
rpmtcl rpmtclNew(char **av, uint32_t flags)
Create and load a tcl interpreter.
rpmRC rpmtclRun(rpmtcl tcl, const char *str, const char **resultp)
Execute tcl string.