• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Jim_SetResultString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Jim_SetResultString函数的典型用法代码示例。如果您正苦于以下问题:C++ Jim_SetResultString函数的具体用法?C++ Jim_SetResultString怎么用?C++ Jim_SetResultString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Jim_SetResultString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Jim_PosixSignalCommand

static int Jim_PosixSignalCommand(Jim_Interp *interp, int argc,
        Jim_Obj *const *argv)
{
    int sig;
    int signum;
    sighandler_t lastaction;
    sighandler_t nextaction = SIG_DFL;
    const char *op;
    int strlen = 0;

    if (argc < 2) {
        Jim_WrongNumArgs(interp, 1, argv, "signame ?action ...?");
        return JIM_ERR;
    }
    if (Jim_GetEnum(interp, argv[1], signames, &sig, "Signal Names",
                JIM_ERRMSG) != JIM_OK)
        return JIM_ERR;

    signum = signums[sig];

    switch (argc) {
    case 3:
	if (op = Jim_GetString(argv[2], &strlen),strlen == 0) {
        	return JIM_ERR;
        }
	if (strcmp("default",op) == 0) {
		nextaction = SIG_DFL;
	} else if (strcmp("ignore",op) == 0) {
		nextaction = SIG_IGN;
	} else if (strcmp("debug",op) == 0) {
		nextaction = Jim_Posix_SigHandler;
	} else {
		// this is the place to insert a script! UK
	}
	// fall through to query case:
    case 2:
	lastaction = signal(signum, nextaction);
	if (argc==2)
		signal(signum, lastaction);
	if (lastaction == SIG_ERR) {
		return JIM_ERR;
	}
	if (lastaction == SIG_DFL) {
		Jim_SetResultString(interp, "default", -1);
		return JIM_OK;
	}
	if (lastaction == SIG_IGN) {
		Jim_SetResultString(interp, "ignore", -1);
		return JIM_OK;
	} 
	Jim_SetResultString(interp, "function", -1);
	return JIM_OK;
    }

    return JIM_OK;
}
开发者ID:alepharchives,项目名称:Jim,代码行数:56,代码来源:jim-posix.c


示例2: JimInterpCommand

/**
 * [interp] creates a new interpreter.
 */
static int JimInterpCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    Jim_Interp *child;
    char buf[32];

    if (argc != 1) {
        Jim_WrongNumArgs(interp, 1, argv, "");
        return JIM_ERR;
    }

    /* Create the interpreter command */
    child = Jim_CreateInterp();
    Jim_RegisterCoreCommands(child);
    Jim_InitStaticExtensions(child);

    /* Copy some core variables to the new interpreter */
    JimInterpCopyVariable(child, interp, "argv", NULL);
    JimInterpCopyVariable(child, interp, "argc", NULL);
    JimInterpCopyVariable(child, interp, "argv0", NULL);
    JimInterpCopyVariable(child, interp, "jim::argv0", NULL);
    JimInterpCopyVariable(child, interp, "jim::exe", NULL);

    /* Allow the child interpreter to find the parent */
    Jim_SetAssocData(child, "interp.parent", NULL, interp);

    snprintf(buf, sizeof(buf), "interp.handle%ld", Jim_GetId(interp));
    Jim_CreateCommand(interp, buf, JimInterpSubCmdProc, child, JimInterpDelProc);
    Jim_SetResultString(interp, buf, -1);
    return JIM_OK;
}
开发者ID:evanhunter,项目名称:jimtcl,代码行数:33,代码来源:jim-interp.c


示例3: GetAnimateWindowFlagsFromObj

static int
GetAnimateWindowFlagsFromObj(Jim_Interp *interp, Jim_Obj *listObj, DWORD *flags)
{
    int r = JIM_OK, n, nLength;
    *flags = 0;
    Jim_ListLength(interp, listObj, &nLength);
    if (r == JIM_OK) {
        for (n = 0; n < nLength; n++) {
            ANIMATEWINDOWFLAGSMAP *p;
            Jim_Obj *obj;
            r = Jim_ListIndex(interp, listObj, n, &obj, 1);
            for (p = AnimateWindowFlagsMap; r == JIM_OK && p->s != NULL; p++) {
                size_t len;
                const char *name = Jim_GetString(obj, &len);
                if (strncmp(p->s, name, len) == 0) {
                    *flags |= p->f;
                    break;
                }
            }
            if (p->s == NULL) {
                Jim_SetResultString(interp, "invalid option", -1);
                return JIM_ERR;
            }
        }
    }
        
    return r;
}
开发者ID:alepharchives,项目名称:Jim,代码行数:28,代码来源:jim-win32.c


示例4: Win32_GetLastInputInfo

static BOOL
Win32_GetLastInputInfo(Jim_Interp *interp, int objc, Jim_Obj *const objv[])
{
    struct lastinputinfo_t {
        UINT cbSize;
        DWORD dwTime;
    } lii;
    typedef BOOL (__stdcall *LPFNGETLASTINPUTINFO)(struct lastinputinfo_t *);
    LPFNGETLASTINPUTINFO lpfnGetLastInputInfo = NULL;
    HMODULE hLib = (HMODULE)Jim_CmdPrivData(interp);
    JIM_NOTUSED(objc);
    JIM_NOTUSED(objv);

    if (hLib != NULL)
        lpfnGetLastInputInfo = (LPFNGETLASTINPUTINFO)GetProcAddress(hLib, "GetLastInputInfo");
    if (lpfnGetLastInputInfo == NULL) {
        Jim_SetResultString(interp, "command not available on this platform", -1);
        return JIM_ERR;
    }

    lii.cbSize = sizeof(lii);
    if (!lpfnGetLastInputInfo(&lii)) {
        Jim_SetResult(interp,
            Win32ErrorObj(interp, "GetLastInputInfo", GetLastError()));
        return JIM_ERR;
    }
    Jim_SetResult(interp, Jim_NewIntObj(interp, lii.dwTime));
    return JIM_OK;
}
开发者ID:alepharchives,项目名称:Jim,代码行数:29,代码来源:jim-win32.c


示例5: Jim_MakeTempFile

int Jim_MakeTempFile(Jim_Interp *interp, const char *filename_template, int unlink_file)
{
    char name[MAX_PATH];
    HANDLE handle;

    if (!GetTempPath(MAX_PATH, name) || !GetTempFileName(name, filename_template ? filename_template : "JIM", 0, name)) {
        return -1;
    }

    handle = CreateFile(name, GENERIC_READ | GENERIC_WRITE, 0, NULL,
            CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY | (unlink_file ? FILE_FLAG_DELETE_ON_CLOSE : 0),
            NULL);

    if (handle == INVALID_HANDLE_VALUE) {
        goto error;
    }

    Jim_SetResultString(interp, name, -1);
    return _open_osfhandle((int)handle, _O_RDWR | _O_TEXT);

  error:
    Jim_SetResultErrno(interp, name);
    DeleteFile(name);
    return -1;
}
开发者ID:msteveb,项目名称:jimtcl,代码行数:25,代码来源:jimiocompat.c


示例6: clock_cmd_format

static int clock_cmd_format(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    /* How big is big enough? */
    char buf[100];
    time_t t;
    long seconds;

    const char *format = "%a %b %d %H:%M:%S %Z %Y";

    if (argc == 2 || (argc == 3 && !Jim_CompareStringImmediate(interp, argv[1], "-format"))) {
        return -1;
    }

    if (argc == 3) {
        format = Jim_String(argv[2]);
    }

    if (Jim_GetLong(interp, argv[0], &seconds) != JIM_OK) {
        return JIM_ERR;
    }
    t = seconds;

    /*@@if (strftime(buf, sizeof(buf), format, localtime(&t)) == 0) {
        Jim_SetResultString(interp, "format string too long", -1);
        return JIM_ERR;
    }*/

    Jim_SetResultString(interp, buf, -1);

    return JIM_OK;
}
开发者ID:doniexun,项目名称:bitthunder,代码行数:31,代码来源:jim-clock.c


示例7: array_cmd_set

static int array_cmd_set(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    int i;
    int len;
    Jim_Obj *listObj = argv[1];
    Jim_Obj *dictObj;

    len = Jim_ListLength(interp, listObj);
    if (len % 2) {
        Jim_SetResultString(interp, "list must have an even number of elements", -1);
        return JIM_ERR;
    }

    dictObj = Jim_GetVariable(interp, argv[0], JIM_UNSHARED);
    if (!dictObj) {
        /* Doesn't exist, so just set the list directly */
        return Jim_SetVariable(interp, argv[0], listObj);
    }

    if (Jim_IsShared(dictObj)) {
        dictObj = Jim_DuplicateObj(interp, dictObj);
    }

    for (i = 0; i < len; i += 2) {
        Jim_Obj *nameObj;
        Jim_Obj *valueObj;

        Jim_ListIndex(interp, listObj, i, &nameObj, JIM_NONE);
        Jim_ListIndex(interp, listObj, i + 1, &valueObj, JIM_NONE);

        Jim_DictAddElement(interp, dictObj, nameObj, valueObj);
    }
    return Jim_SetVariable(interp, argv[0], dictObj);
}
开发者ID:JimmyDurandWesolowski,项目名称:openocd,代码行数:34,代码来源:jim-array.c


示例8: signal_cmd_throw

static int signal_cmd_throw(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    int sig = SIGINT;

    if (argc == 1) {
        if ((sig = find_signal_by_name(interp, Jim_String(argv[0]))) < 0) {
            return JIM_ERR;
        }
    }

    /* If the signal is ignored (blocked) ... */
    if (siginfo[sig].status == SIGNAL_ACTION_IGNORE) {
        sigsblocked |= sig_to_bit(sig);
        return JIM_OK;
    }

    /* Just set the signal */
    interp->sigmask |= sig_to_bit(sig);

    /* Set the canonical name of the signal as the result */
    Jim_SetResultString(interp, Jim_SignalId(sig), -1);

    /* And simply say we caught the signal */
    return JIM_SIGNAL;
}
开发者ID:dgsb,项目名称:jimtcl,代码行数:25,代码来源:jim-signal.c


示例9: find_signal_by_name

/**
 * Given the name of a signal, returns the signal value if found,
 * or returns -1 (and sets an error) if not found.
 * We accept -SIGINT, SIGINT, INT or any lowercase version or a number,
 * either positive or negative.
 */
static int find_signal_by_name(Jim_Interp *interp, const char *name)
{
    int i;
    const char *pt = name;

    /* Remove optional - and SIG from the front of the name */
    if (*pt == '-') {
        pt++;
    }
    if (strncasecmp(name, "sig", 3) == 0) {
        pt += 3;
    }
    if (isdigit(UCHAR(pt[0]))) {
        i = atoi(pt);
        if (i > 0 && i < MAX_SIGNALS) {
            return i;
        }
    }
    else {
        for (i = 1; i < MAX_SIGNALS; i++) {
            /* Jim_SignalId() returns names such as SIGINT, and
             * returns "unknown signal id" if unknown, so this will work
             */
            if (strcasecmp(Jim_SignalId(i) + 3, pt) == 0) {
                return i;
            }
        }
    }
    Jim_SetResultString(interp, "unknown signal ", -1);
    Jim_AppendString(interp, Jim_GetResult(interp), name, -1);

    return -1;
}
开发者ID:JimmyDurandWesolowski,项目名称:openocd,代码行数:39,代码来源:jim-signal.c


示例10: JimMakeChannel

/**
 * Creates a channel for fh/fd/filename.
 *
 * If fh is not NULL, uses that as the channel (and set AIO_KEEPOPEN).
 * Otherwise, if fd is >= 0, uses that as the chanel.
 * Otherwise opens 'filename' with mode 'mode'.
 *
 * hdlfmt is a sprintf format for the filehandle. Anything with %ld at the end will do.
 * mode is used for open or fdopen.
 *
 * Creates the command and sets the name as the current result.
 */
static int JimMakeChannel(Jim_Interp *interp, FILE *fh, int fd, Jim_Obj *filename,
    const char *hdlfmt, int family, const char *mode)
{
    AioFile *af;
    char buf[AIO_CMD_LEN];
    int OpenFlags = 0;

    if (filename == NULL) {
        filename = Jim_NewStringObj(interp, hdlfmt, -1);
    }

    Jim_IncrRefCount(filename);

    if (fh == NULL) {
        if (fd < 0) {
            fh = fopen(Jim_String(filename), mode);
        }
        else {
            fh = fdopen(fd, mode);
        }
    }
    else {
        OpenFlags = AIO_KEEPOPEN;
    }

    if (fh == NULL) {
        JimAioSetError(interp, filename);
#if !defined(JIM_ANSIC)
        if (fd >= 0) {
            close(fd);
        }
#endif
        Jim_DecrRefCount(interp, filename);
        return JIM_ERR;
    }

    /* Create the file command */
    af = Jim_Alloc(sizeof(*af));
    memset(af, 0, sizeof(*af));
    af->fp = fh;
    af->fd = fileno(fh);
    af->filename = filename;
#ifdef FD_CLOEXEC
    if ((OpenFlags & AIO_KEEPOPEN) == 0) {
        fcntl(af->fd, F_SETFD, FD_CLOEXEC);
    }
#endif
    af->OpenFlags = OpenFlags;
#ifdef O_NDELAY
    af->flags = fcntl(af->fd, F_GETFL);
#endif
    af->addr_family = family;
    snprintf(buf, sizeof(buf), hdlfmt, Jim_GetId(interp));
    Jim_CreateCommand(interp, buf, JimAioSubCmdProc, af, JimAioDelProc);

    Jim_SetResultString(interp, buf, -1);

    return JIM_OK;
}
开发者ID:alex-shpilkin,项目名称:jimtcl,代码行数:71,代码来源:jim-aio.c


示例11: Jim_Alloc

            /* Add this handle to the stack of handles to be freed */
            if (!interp->loadHandles) {
                interp->loadHandles = Jim_Alloc(sizeof(*interp->loadHandles));
                Jim_InitStack(interp->loadHandles);
            }
            Jim_StackPush(interp->loadHandles, handle);

            Jim_SetEmptyResult(interp);

            return JIM_OK;
        }
    }
    if (handle) {
        dlclose(handle);
    }
    return JIM_ERR;
}

static void JimFreeOneLoadHandle(void *handle)
{
    dlclose(handle);
}

void Jim_FreeLoadHandles(Jim_Interp *interp)
{
    if (interp->loadHandles) {
        Jim_FreeStackElements(interp->loadHandles, JimFreeOneLoadHandle);
        Jim_Free(interp->loadHandles);
    }
}

#else /* JIM_DYNLIB */
int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName)
{
    JIM_NOTUSED(interp);
    JIM_NOTUSED(pathName);

    Jim_SetResultString(interp, "the Jim binary has no support for [load]", -1);
    return JIM_ERR;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:40,代码来源:jim-load.c


示例12: Jim_Decompress

static int Jim_Decompress(Jim_Interp *interp, const char *in, int len, long bufsiz, int wbits)
{
    z_stream strm = {0};
    void *buf;
    Jim_Obj *out;
    int ret;

    if (JimZlibCheckBufSize(interp, bufsiz)) {
        return JIM_ERR;
    }

    if (inflateInit2(&strm, wbits) != Z_OK) {
        return JIM_ERR;
    }

    /* allocate a buffer - decompression is done in chunks, into this buffer;
     * when the decompressed data size is given, decompression is faster because
     * it's done in one pass, with less memcpy() overhead */
    buf = Jim_Alloc((int)bufsiz);

    out = Jim_NewEmptyStringObj(interp);
    Jim_IncrRefCount(out);

    strm.next_in = (Bytef*)in;
    strm.avail_in = (uInt)len;
    do {
        do {
            strm.next_out = buf;
            strm.avail_out = (uInt)bufsiz;

            ret = inflate(&strm, Z_NO_FLUSH);
            switch (ret) {
            case Z_OK:
            case Z_STREAM_END:
                /* append each chunk to the output object */
                Jim_AppendString(interp, out, buf, (int)(bufsiz - (long)strm.avail_out));
                break;

            default:
                Jim_DecrRefCount(interp, out);
                Jim_Free(buf);
                inflateEnd(&strm);
                if (strm.msg != NULL)
                    Jim_SetResultString(interp, strm.msg, -1);
                return JIM_ERR;
            }
        } while (strm.avail_out == 0);
    } while (ret != Z_STREAM_END);

    /* free memory used for decompression before we assign the return value */
    Jim_Free(buf);
    inflateEnd(&strm);

    Jim_SetResult(interp, out);
    Jim_DecrRefCount(interp, out);

    return JIM_OK;
}
开发者ID:evanhunter,项目名称:jimtcl,代码行数:58,代码来源:jim-zlib.c


示例13: Jim_ReaddirCmd

/*
 *-----------------------------------------------------------------------------
 *
 * Jim_ReaddirCmd --
 *     Implements the rename TCL command:
 *         readdir ?-nocomplain? dirPath
 *
 * Results:
 *      Standard TCL result.
 *-----------------------------------------------------------------------------
 */
int
Jim_ReaddirCmd (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    const char          *dirPath;
    DIR           *dirPtr;
    struct dirent *entryPtr;
    int nocomplain = 0;

    if (argc == 3 && Jim_CompareStringImmediate(interp, argv[1], "-nocomplain")) {
        nocomplain = 1;
    }
    if (argc != 2 && !nocomplain) {
        Jim_WrongNumArgs(interp, 1, argv, "?-nocomplain? dirPath");
        return JIM_ERR;
    }

    dirPath = Jim_GetString(argv[1 + nocomplain], NULL);

    dirPtr = opendir (dirPath);
    if (dirPtr == NULL)  {
        if (nocomplain) {
            return JIM_OK;
        }
        Jim_SetResultString(interp, strerror(errno), -1);
        return JIM_ERR;
    }
    Jim_SetResultString(interp, strerror(errno), -1);

    Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0));

    while ((entryPtr = readdir (dirPtr)) != NULL) {
        if (entryPtr->d_name [0] == '.') {
            if (entryPtr->d_name [1] == '\0') {
                continue;
            }
            if ((entryPtr->d_name [1] == '.') &&
                (entryPtr->d_name [2] == '\0'))
                continue;
        }
        Jim_ListAppendElement(interp, Jim_GetResult(interp), Jim_NewStringObj(interp, entryPtr->d_name, -1));
    }
    closedir (dirPtr);

    return JIM_OK;
}
开发者ID:fmutant,项目名称:scriptorium,代码行数:56,代码来源:jim-readdir.c


示例14: JimTrimTrailingNewline

/*
 * If the last character of the result is a newline, then remove
 * the newline character (the newline would just confuse things).
 *
 * Note: Ideally we could do this by just reducing the length of stringrep
 *       by 1, but there is no API for this :-(
 */
static void JimTrimTrailingNewline(Jim_Interp *interp)
{
    int len;
    const char *p = Jim_GetString(Jim_GetResult(interp), &len);

    if (len > 0 && p[len - 1] == '\n') {
        Jim_SetResultString(interp, p, len - 1);
    }
}
开发者ID:dokterp,项目名称:jimtcl,代码行数:16,代码来源:jim-exec.c


示例15: JimAioSetError

static void JimAioSetError(Jim_Interp *interp, Jim_Obj *name)
{
    if (name) {
        Jim_SetResultFormatted(interp, "%#s: %s", name, strerror(errno));
    }
    else {
        Jim_SetResultString(interp, strerror(errno), -1);
    }
}
开发者ID:alex-shpilkin,项目名称:jimtcl,代码行数:9,代码来源:jim-aio.c


示例16: JimZlibCheckBufSize

static int JimZlibCheckBufSize(Jim_Interp *interp, jim_wide bufsiz)
{
    if ((bufsiz <= 0) || (bufsiz > INT_MAX)) {
        Jim_SetResultString(interp, "buffer size must be 0 to ", -1);
        Jim_AppendObj(interp, Jim_GetResult(interp), Jim_NewIntObj(interp, INT_MAX));
        return JIM_ERR;
    }
    return JIM_OK;
}
开发者ID:evanhunter,项目名称:jimtcl,代码行数:9,代码来源:jim-zlib.c


示例17: Jim_Command_pathmove

static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *args)
{
	tap_state_t states[8];

	if ((argc < 2) || ((size_t)argc > (ARRAY_SIZE(states) + 1)))
	{
		Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
		return JIM_ERR;
	}

	script_debug(interp, "pathmove", argc, args);

	int i;
	for (i = 0; i < argc-1; i++)
	{
		const char *cp;
		cp = Jim_GetString(args[i + 1], NULL);
		states[i] = tap_state_by_name(cp);
		if (states[i] < 0)
		{
			/* update the error message */
			Jim_SetResultFormatted(interp,"endstate: %s invalid", cp);
			return JIM_ERR;
		}
	}

	if ((jtag_add_statemove(states[0]) != ERROR_OK) || (jtag_execute_queue()!= ERROR_OK))
	{
		Jim_SetResultString(interp, "pathmove: jtag execute failed",-1);
		return JIM_ERR;
	}

	jtag_add_pathmove(argc-2, states + 1);

	if (jtag_execute_queue()!= ERROR_OK)
	{
		Jim_SetResultString(interp, "pathmove: failed",-1);
		return JIM_ERR;
	}

	return JIM_OK;
}
开发者ID:Erguotou,项目名称:openocd-libswd,代码行数:42,代码来源:tcl.c


示例18: file_cmd_extension

static int file_cmd_extension(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    const char *path = Jim_String(argv[0]);
    const char *lastSlash = strrchr(path, '/');
    const char *p = strrchr(path, '.');

    if (p == NULL || (lastSlash != NULL && lastSlash >= p)) {
        p = "";
    }
    Jim_SetResultString(interp, p, -1);
    return JIM_OK;
}
开发者ID:BitThunder,项目名称:bitthunder,代码行数:12,代码来源:jim-file.c


示例19: JimELAfterCommand

static int JimELAfterCommand(Jim_Interp *interp, int argc, 
        Jim_Obj *const *argv)
{
    jim_wide ms, id;
    Jim_Obj *objPtr, *idObjPtr;
    const char *options[] = {
	"info", "cancel", "restart", "expire", NULL
    };
    enum {INFO, CANCEL, RESTART, EXPIRE, CREATE };
    int option = CREATE ;

    if (argc < 3) {
        Jim_WrongNumArgs(interp, 1, argv, "<after milliseconds> script");
        return JIM_ERR;
    }
    if (Jim_GetWide(interp, argv[1], &ms) != JIM_OK)
        if (Jim_GetEnum(interp, argv[1], options, &option, "after options",
                    JIM_ERRMSG) != JIM_OK)
            return JIM_ERR;
    switch (option) {
    case CREATE:
        Jim_IncrRefCount(argv[2]);
        id = Jim_CreateTimeHandler(interp, ms, JimAfterTimeHandler, argv[2],
                JimAfterTimeEventFinalizer);
        objPtr = Jim_NewStringObj(interp, NULL, 0);
        Jim_AppendString(interp, objPtr, "after#", -1);
        idObjPtr = Jim_NewIntObj(interp, id);
        Jim_IncrRefCount(idObjPtr);
        Jim_AppendObj(interp, objPtr, idObjPtr);
        Jim_DecrRefCount(interp, idObjPtr);
        Jim_SetResult(interp, objPtr);
        return JIM_OK;
    case CANCEL:
	{
	int tlen ;
	jim_wide remain = 0;
	const char *tok = Jim_GetString(argv[2], &tlen);
	if ( sscanf(tok,"after#%lld",&id) == 1) {
		remain =  Jim_DeleteTimeHandler(interp, id);
		if (remain > -2)  {
			Jim_SetResult(interp, Jim_NewIntObj(interp, remain));
			return JIM_OK;
		}
	}
        Jim_SetResultString(interp, "invalid event" , -1);
        return JIM_ERR;
	}
    default:
	fprintf(stderr,"unserviced option to after %d\n",option);
    } 
    return JIM_OK;
}
开发者ID:unnamet,项目名称:estick-jtag,代码行数:52,代码来源:jim-eventloop.c


示例20: file_cmd_tail

static int file_cmd_tail(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    const char *path = Jim_String(argv[0]);
    const char *lastSlash = strrchr(path, '/');

    if (lastSlash) {
        Jim_SetResultString(interp, lastSlash + 1, -1);
    }
    else {
        Jim_SetResult(interp, argv[0]);
    }
    return JIM_OK;
}
开发者ID:BitThunder,项目名称:bitthunder,代码行数:13,代码来源:jim-file.c



注:本文中的Jim_SetResultString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Jim_WrongNumArgs函数代码示例发布时间:2022-05-30
下一篇:
C++ Jim_SetResult函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap