本文整理汇总了C++中Tcl_SetObjResult函数的典型用法代码示例。如果您正苦于以下问题:C++ Tcl_SetObjResult函数的具体用法?C++ Tcl_SetObjResult怎么用?C++ Tcl_SetObjResult使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Tcl_SetObjResult函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NS
int NS(ReadBDY) (NS_ARGS)
{
SETUP_mqctx
MQ_BIN val;
MQ_SIZE len;
CHECK_NOARGS
ErrorMqToTclWithCheck(MqReadBDY(mqctx, &val, &len));
Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(val,len));
MqSysFree (val);
RETURN_TCL
}
示例2: NS
int NS(LinkGetParent) (NS_ARGS)
{
struct MqS * const parent = MqLinkGetParentI(MQCTX);
CHECK_NOARGS
if (parent != NULL) {
Tcl_SetObjResult(interp,(Tcl_Obj*)parent->self);
} else {
Tcl_SetResult(interp,"", TCL_STATIC);
}
RETURN_TCL
}
示例3: isMapped
static int isMapped( Tcl_Interp *interp, GtkWidget *widget,
int objc, Tcl_Obj * const objv[] )
{
if( objc != 2 )
{
Tcl_WrongNumArgs( interp, 1, objv, NULL );
return TCL_ERROR;
}
Tcl_SetObjResult( interp,
Tcl_NewBooleanObj( GTK_WIDGET_MAPPED( widget ) ) );
return TCL_OK;
}
示例4: windowToCanvas
static int windowToCanvas( Tcl_Interp *interp,
int objc, Tcl_Obj * const objv[], CanvasParams *params, int reverse )
{
Tcl_Obj *resList;
int noCoords, n;
if( objc != 3 )
{
Tcl_WrongNumArgs( interp, 2, objv,
/* canvas windowToCanvas */
"list-of-coordinates ?option val ...?" );
return TCL_ERROR;
}
/* TODO
-only [xy]: only x, y coordinates
-pairs [true|false]: list of coordinate pairs (lists)
*/
if( Tcl_ListObjLength( interp, objv[2], &noCoords ) != TCL_OK
|| ( noCoords % 2 ) )
{
Tcl_SetResult( interp,
"size of list-of-coordinates must be even",
TCL_STATIC );
return TCL_ERROR;
}
resList = Tcl_NewListObj( 0, NULL );
for( n = 0; n < noCoords; n += 2 )
{
Tcl_Obj *tp;
double xw, yw, x, y;
int ret = Tcl_ListObjIndex( interp, objv[2], n, &tp );
if( ret == TCL_OK )
ret = Tcl_GetDoubleFromObj( interp, tp, &xw );
if( ret == TCL_OK )
ret = Tcl_ListObjIndex( interp, objv[2], n + 1, &tp );
if( ret == TCL_OK )
ret = Tcl_GetDoubleFromObj( interp, tp, &yw );
if( ret != TCL_OK )
{
Tcl_DecrRefCount( resList ); /* FIXME: is this correct? */
return TCL_ERROR;
}
if( reverse )
gnome_canvas_world_to_window( params->canvas, xw, yw, &x, &y );
else
gnome_canvas_window_to_world( params->canvas, xw, yw, &x, &y );
Tcl_ListObjAppendElement( interp, resList, Tcl_NewDoubleObj( x ) );
Tcl_ListObjAppendElement( interp, resList, Tcl_NewDoubleObj( y ) );
}
Tcl_SetObjResult( interp, resList );
return TCL_OK;
}
示例5: _get
static int _get(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj* const *objv) {
// return the current detimed string
_t *dp = (_t *)clientData;
// hmm, how to avoid the buffer here, allocate a byte array?
unsigned n = ring_buffer_items_available_to_read(&dp->ring);
// fprintf(stderr, "%s:%d %u bytes available\n", __FILE__, __LINE__, n);
Tcl_Obj *result = Tcl_NewObj();
char *buff = Tcl_SetByteArrayLength(result, n);
ring_buffer_get(&dp->ring, n, buff);
Tcl_SetObjResult(interp, result);
return TCL_OK;
}
示例6: _get
static int _get(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj* const *objv) {
if (argc != 2)
return fw_error_obj(interp, Tcl_ObjPrintf("usage: %s get", Tcl_GetString(objv[0])));
_t *data = (_t *)clientData;
Tcl_Obj *result[] = {
Tcl_NewIntObj(jack_frame_time(data->fw.client)),
Tcl_NewDoubleObj(data->sam.pll.freq.f),
NULL
};
Tcl_SetObjResult(interp, Tcl_NewListObj(2, result));
return TCL_OK;
}
示例7: TestfindwindowObjCmd
static int
TestfindwindowObjCmd(
ClientData clientData, /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
{
const TCHAR *title = NULL, *class = NULL;
Tcl_DString titleString, classString;
HWND hwnd = NULL;
int r = TCL_OK;
Tcl_DStringInit(&classString);
Tcl_DStringInit(&titleString);
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "title ?class?");
return TCL_ERROR;
}
title = Tcl_WinUtfToTChar(Tcl_GetString(objv[1]), -1, &titleString);
if (objc == 3) {
class = Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
}
hwnd = FindWindow(class, title);
if (hwnd == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1));
AppendSystemError(interp, GetLastError());
r = TCL_ERROR;
} else {
Tcl_SetObjResult(interp, Tcl_NewLongObj(PTR2INT(hwnd)));
}
Tcl_DStringFree(&titleString);
Tcl_DStringFree(&classString);
return r;
}
示例8: Tcl_SetObjResult
Ttk_ElementClass *Ttk_RegisterElement(
Tcl_Interp *interp, /* Where to leave error messages */
Ttk_Theme theme, /* Style engine providing the implementation. */
const char *name, /* Name of new element */
Ttk_ElementSpec *specPtr, /* Static template information */
void *clientData) /* application-specific data */
{
Ttk_ElementClass *elementClass;
Tcl_HashEntry *entryPtr;
int newEntry;
if (specPtr->version != TK_STYLE_VERSION_2) {
/* Version mismatch */
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"Internal error: Ttk_RegisterElement (%s): invalid version",
name));
Tcl_SetErrorCode(interp, "TTK", "REGISTER_ELEMENT", "VERSION",
NULL);
}
return 0;
}
entryPtr = Tcl_CreateHashEntry(&theme->elementTable, name, &newEntry);
if (!newEntry) {
if (interp) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"Duplicate element %s", name));
Tcl_SetErrorCode(interp, "TTK", "REGISTER_ELEMENT", "DUPE", NULL);
}
return 0;
}
name = Tcl_GetHashKey(&theme->elementTable, entryPtr);
elementClass = NewElementClass(name, specPtr, clientData);
Tcl_SetHashValue(entryPtr, elementClass);
return elementClass;
}
示例9: cget
static int cget( Tcl_Interp *interp, GnomeCanvas *canvas,
GnoclOption options[], int idx )
{
Tcl_Obj *obj = NULL;
if( obj != NULL )
{
Tcl_SetObjResult( interp, obj );
return TCL_OK;
}
return gnoclCgetNotImplemented( interp, options + idx );
}
示例10: TkGetServerInfo
void
TkGetServerInfo(
Tcl_Interp *interp, /* The server information is returned in this
* interpreter's result. */
Tk_Window tkwin) /* Token for window; this selects a particular
* display and server. */
{
Tcl_SetObjResult(interp, Tcl_ObjPrintf("X%dR%d %s %d",
ProtocolVersion(Tk_Display(tkwin)),
ProtocolRevision(Tk_Display(tkwin)),
ServerVendor(Tk_Display(tkwin)),
VendorRelease(Tk_Display(tkwin))));
}
示例11: thwl_set_result_cbitmap
int
thwl_set_result_cbitmap (Tcl_Interp* interp, hwloc_const_bitmap_t bitmap) {
char* res;
if (hwloc_bitmap_list_asprintf(&res, bitmap) == -1) {
Tcl_SetResult(interp, "hwloc_bitmap_list_asprintf() failed", TCL_STATIC);
return TCL_ERROR;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(res, -1));
free(res);
return TCL_OK;
}
示例12: PlaceInfoCommand
static int
PlaceInfoCommand(
Tcl_Interp *interp, /* Interp into which to place result. */
Tk_Window tkwin) /* Token for the window to get info on. */
{
Slave *slavePtr;
Tcl_Obj *infoObj;
slavePtr = FindSlave(tkwin);
if (slavePtr == NULL) {
return TCL_OK;
}
infoObj = Tcl_NewObj();
if (slavePtr->masterPtr != NULL) {
Tcl_AppendToObj(infoObj, "-in", -1);
Tcl_ListObjAppendElement(NULL, infoObj,
TkNewWindowObj(slavePtr->masterPtr->tkwin));
Tcl_AppendToObj(infoObj, " ", -1);
}
Tcl_AppendPrintfToObj(infoObj,
"-x %d -relx %.4g -y %d -rely %.4g",
slavePtr->x, slavePtr->relX, slavePtr->y, slavePtr->relY);
if (slavePtr->flags & CHILD_WIDTH) {
Tcl_AppendPrintfToObj(infoObj, " -width %d", slavePtr->width);
} else {
Tcl_AppendToObj(infoObj, " -width {}", -1);
}
if (slavePtr->flags & CHILD_REL_WIDTH) {
Tcl_AppendPrintfToObj(infoObj,
" -relwidth %.4g", slavePtr->relWidth);
} else {
Tcl_AppendToObj(infoObj, " -relwidth {}", -1);
}
if (slavePtr->flags & CHILD_HEIGHT) {
Tcl_AppendPrintfToObj(infoObj, " -height %d", slavePtr->height);
} else {
Tcl_AppendToObj(infoObj, " -height {}", -1);
}
if (slavePtr->flags & CHILD_REL_HEIGHT) {
Tcl_AppendPrintfToObj(infoObj,
" -relheight %.4g", slavePtr->relHeight);
} else {
Tcl_AppendToObj(infoObj, " -relheight {}", -1);
}
Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s",
Tk_NameOfAnchor(slavePtr->anchor),
borderModeStrings[slavePtr->borderMode]);
Tcl_SetObjResult(interp, infoObj);
return TCL_OK;
}
示例13: Tcl_PidObjCmd
/* ARGSUSED */
int
Tcl_PidObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const *objv) /* Argument strings. */
{
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?channelId?");
return TCL_ERROR;
}
if (objc == 1) {
Tcl_SetObjResult(interp, Tcl_NewLongObj((long) getpid()));
} else {
Tcl_Channel chan;
const Tcl_ChannelType *chanTypePtr;
PipeState *pipePtr;
int i;
Tcl_Obj *resultPtr, *longObjPtr;
chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL);
if (chan == (Tcl_Channel) NULL) {
return TCL_ERROR;
}
chanTypePtr = Tcl_GetChannelType(chan);
if (chanTypePtr != &pipeChannelType) {
return TCL_OK;
}
pipePtr = (PipeState *) Tcl_GetChannelInstanceData(chan);
resultPtr = Tcl_NewObj();
for (i = 0; i < pipePtr->numPids; i++) {
longObjPtr = Tcl_NewLongObj((long) TclpGetPid(pipePtr->pidPtr[i]));
Tcl_ListObjAppendElement(NULL, resultPtr, longObjPtr);
}
Tcl_SetObjResult(interp, resultPtr);
}
return TCL_OK;
}
示例14: gnoclComboCmd
int gnoclComboCmd ( ClientData data, Tcl_Interp *interp,
int objc, Tcl_Obj * const objv[] )
{
ComboParams *para;
int ret;
if ( gnoclParseOptions ( interp, objc, objv, comboOptions )
!= TCL_OK )
{
gnoclClearOptions ( comboOptions );
return TCL_ERROR;
}
para = g_new ( ComboParams, 1 );
para->interp = interp;
para->combo = GTK_COMBO ( gtk_combo_new( ) );
para->variable = NULL;
para->onChanged = NULL;
para->inSetVar = 0;
ret = gnoclSetOptions ( interp, comboOptions,
G_OBJECT ( para->combo ), -1 );
if ( ret == TCL_OK )
ret = configure ( interp, para, comboOptions );
gnoclClearOptions ( comboOptions );
if ( ret != TCL_OK )
{
g_free ( para );
gtk_widget_destroy ( GTK_WIDGET ( para->combo ) );
return TCL_ERROR;
}
para->name = gnoclGetAutoWidgetId();
g_signal_connect ( G_OBJECT ( para->combo ), "destroy",
G_CALLBACK ( destroyFunc ), para );
gnoclMemNameAndWidget ( para->name, GTK_WIDGET ( para->combo ) );
gtk_widget_show ( GTK_WIDGET ( para->combo ) );
Tcl_CreateObjCommand ( interp, para->name, comboFunc, para, NULL );
Tcl_SetObjResult ( interp, Tcl_NewStringObj ( para->name, -1 ) );
return TCL_OK;
}
示例15: FinalizeConstruction
static int
FinalizeConstruction(
ClientData data[],
Tcl_Interp *interp,
int result)
{
Object *oPtr = data[0];
if (result != TCL_OK) {
return result;
}
Tcl_SetObjResult(interp, TclOOObjectName(interp, oPtr));
return TCL_OK;
}