当前位置: 首页>>代码示例>>C++>>正文


C++ Jim_SetResult函数代码示例

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


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

示例1: Win32_GetCursorInfo

static int
Win32_GetCursorInfo(Jim_Interp *interp, int objc, Jim_Obj *const objv[])
{
    Jim_Obj *a[8];
    size_t n = 0;
    CURSORINFO ci;

    JIM_NOTUSED(objc);
    JIM_NOTUSED(objv);

    ci.cbSize = sizeof(ci);
    if (!GetCursorInfo(&ci)) {
        Jim_SetResult(interp,
            Win32ErrorObj(interp, "GetCursorInfo", GetLastError()));
        return JIM_ERR;
    }
    
#define JIMADDN(name) a[n++] = Jim_NewStringObj(interp, #name, -1);
#define JIMADDV(v)    a[n++] = Jim_NewIntObj(interp, (v));
    JIMADDN(flags);   JIMADDV(ci.flags);
    JIMADDN(hCursor); JIMADDV((DWORD)ci.hCursor);
    JIMADDN(x);       JIMADDV(ci.ptScreenPos.x);
    JIMADDN(y);       JIMADDV(ci.ptScreenPos.y);
#undef JIMADDN
#undef JIMADDV

    Jim_SetResult(interp, Jim_NewListObj(interp, a, n));
    return JIM_OK;
}
开发者ID:alepharchives,项目名称:Jim,代码行数:29,代码来源:jim-win32.c

示例2: Win32_LoadCursor

static int
Win32_LoadCursor(Jim_Interp *interp, int objc, Jim_Obj *const objv[])
{
    HCURSOR hCursor;
    int ndx;
    static const char *name[] = {
        "appstarting", "arrow", "cross", "hand", "help", "ibeam",
        "icon", "no", "size", "sizeall", "sizenesw", "sizens",
        "sizenwse", "sizewe", "uparrow", "wait", NULL
    };
    static LPCTSTR id[] = {
        IDC_APPSTARTING, IDC_ARROW, IDC_CROSS, IDC_HAND, IDC_HELP, IDC_IBEAM,
        IDC_ICON, IDC_NO, IDC_SIZEALL, IDC_SIZEALL, IDC_SIZENESW, IDC_SIZENS,
        IDC_SIZENWSE, IDC_UPARROW, IDC_WAIT, NULL
    };

    if (objc != 2) {
        Jim_WrongNumArgs(interp, 1, objv, "name");
        return JIM_ERR;
    }
    
    if (Jim_GetEnum(interp, objv[1], name, &ndx, "cursor name", JIM_ERRMSG) != JIM_OK)
        return JIM_ERR;
    
    hCursor = LoadCursor((HINSTANCE)NULL, id[ndx]);
    if (hCursor == NULL) {
        Jim_SetResult(interp,
                      Win32ErrorObj(interp, "LoadCursor", GetLastError()));
        return JIM_ERR;
    }
    
    Jim_SetResult(interp, Jim_NewIntObj(interp, (DWORD)hCursor));
    return JIM_OK;
}
开发者ID:alepharchives,项目名称:Jim,代码行数:34,代码来源:jim-win32.c

示例3: 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

示例4: Win32_FindWindow

/* win32.FindWindow title ?class? */
static int
Win32_FindWindow(Jim_Interp *interp, int objc, Jim_Obj * const *objv)
{
    const char *title = NULL, *class = NULL;
    HWND hwnd = NULL;
    int r = JIM_OK;

    if (objc < 2 || objc > 3) {
        Jim_WrongNumArgs(interp, 1, objv, "title ?class?");
        return JIM_ERR;
    }
    title = Jim_String(objv[1]);
    if (objc == 3)
        class = Jim_String(objv[2]);
    hwnd = FindWindowA(class, title);

    if (hwnd == NULL) {
        Jim_SetResult(interp,
            Win32ErrorObj(interp, "FindWindow", GetLastError()));
        r = JIM_ERR;
    } else {
        Jim_SetResult(interp, Jim_NewIntObj(interp, (long)hwnd));
    }
    return r;
}
开发者ID:hummypkg,项目名称:jimtcl,代码行数:26,代码来源:jim-win32.c

示例5: Win32_GetPerformanceInfo

// FIX ME: win2k+ so should do version checks really.
static int
Win32_GetPerformanceInfo(Jim_Interp *interp, int objc, Jim_Obj * const *objv)
{
    Jim_Obj *a[26];
    size_t n = 0;
    PERFORMANCE_INFORMATION pi;

    if (!GetPerformanceInfo(&pi, sizeof(pi))) {
        Jim_SetResult(interp,
            Win32ErrorObj(interp, "GetPerformanceInfo", GetLastError()));
        return JIM_ERR;
    }

#define JIMADD(name) \
    a[n++] = Jim_NewStringObj(interp, #name, -1); \
    a[n++] = Jim_NewIntObj(interp, pi. name )

    JIMADD(CommitTotal);
    JIMADD(CommitLimit);
    JIMADD(CommitPeak);
    JIMADD(PhysicalTotal);
    JIMADD(PhysicalAvailable);
    JIMADD(SystemCache);
    JIMADD(KernelTotal);
    JIMADD(KernelPaged);
    JIMADD(KernelNonpaged);
    JIMADD(PageSize);
    JIMADD(HandleCount);
    JIMADD(ProcessCount);
    JIMADD(ThreadCount);
#undef JIMADD

    Jim_SetResult(interp, Jim_NewListObj(interp, a, n));
    return JIM_OK;
}
开发者ID:hummypkg,项目名称:jimtcl,代码行数:36,代码来源:jim-win32.c

示例6: Win32_GetModuleFileName

static int
Win32_GetModuleFileName(Jim_Interp *interp, int objc, Jim_Obj * const *objv)
{
    HMODULE hModule = NULL;
    char path[MAX_PATH];
    DWORD len = 0;

    if (objc > 2) {
        Jim_WrongNumArgs(interp, 1, objv, "?moduleid?");
        return JIM_ERR;
    }

    if (objc == 2) {
        if (Jim_GetLong(interp, objv[1], (long *)&hModule) != JIM_OK) {
            return JIM_ERR;
        }
    }

    len = GetModuleFileNameA(hModule, path, MAX_PATH);
    if (len != 0) {
        Jim_Obj *pathObj = Jim_NewStringObj(interp, path, len);
        Jim_SetResult(interp, pathObj);
    } else {
        Jim_SetResult(interp,
            Win32ErrorObj(interp, "GetModuleFileName", GetLastError()));
        return JIM_ERR;
    }

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

示例7: 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

示例8: Win32_GetPerformanceInfo

static int
Win32_GetPerformanceInfo(Jim_Interp *interp, int objc, Jim_Obj *const *objv)
{
    Jim_Obj *a[26];
    size_t n = 0;
    PERFORMANCE_INFORMATION pi;
    LPFNGETPERFORMANCEINFO lpfnGetPerformanceInfo = NULL;
    HMODULE hLib = (HMODULE)Jim_CmdPrivData(interp);
    JIM_NOTUSED(objc);
    JIM_NOTUSED(objv);

    if (hLib != NULL)
        lpfnGetPerformanceInfo = (LPFNGETPERFORMANCEINFO)GetProcAddress(hLib, "GetPerformanceInfo");
    if (lpfnGetPerformanceInfo == NULL) {
        /* should never happen */
        Jim_SetResultString(interp, "argh!", -1);
        return JIM_ERR;
    }

    pi.cb = sizeof(pi);
    if (!lpfnGetPerformanceInfo(&pi, sizeof(pi))) {
        Jim_SetResult(interp,
            Win32ErrorObj(interp, "GetPerformanceInfo", GetLastError()));
        return JIM_ERR;
    }

#define JIMADD(name) \
    a[n++] = Jim_NewStringObj(interp, #name, -1); \
    a[n++] = Jim_NewIntObj(interp, pi.name )

    JIMADD(CommitTotal);
    JIMADD(CommitLimit);
    JIMADD(CommitPeak);
    JIMADD(PhysicalTotal);
    JIMADD(PhysicalAvailable);
    JIMADD(SystemCache);
    JIMADD(KernelTotal);
    JIMADD(KernelPaged);
    JIMADD(KernelNonpaged);
    JIMADD(PageSize);
    JIMADD(HandleCount);
    JIMADD(ProcessCount);
    JIMADD(ThreadCount);
#undef JIMADD

    Jim_SetResult(interp, Jim_NewListObj(interp, a, n));
    return JIM_OK;
}
开发者ID:alepharchives,项目名称:Jim,代码行数:48,代码来源:jim-win32.c

示例9: aio_eventinfo

static int aio_eventinfo(Jim_Interp *interp, AioFile * af, unsigned mask, Jim_Obj **scriptHandlerObj,
    int argc, Jim_Obj * const *argv)
{
    int scriptlen = 0;

    if (argc == 0) {
        /* Return current script */
        if (*scriptHandlerObj) {
            Jim_SetResult(interp, *scriptHandlerObj);
        }
        return JIM_OK;
    }

    if (*scriptHandlerObj) {
        /* Delete old handler */
        Jim_DeleteFileHandler(interp, af->fp);
        *scriptHandlerObj = NULL;
    }

    /* Now possibly add the new script(s) */
    Jim_GetString(argv[0], &scriptlen);
    if (scriptlen == 0) {
        /* Empty script, so done */
        return JIM_OK;
    }

    /* A new script to add */
    Jim_IncrRefCount(argv[0]);
    *scriptHandlerObj = argv[0];

    Jim_CreateFileHandler(interp, af->fp, mask,
        JimAioFileEventHandler, *scriptHandlerObj, JimAioFileEventFinalizer);

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

示例10: ioutil_Jim_Command_ls

static int ioutil_Jim_Command_ls(Jim_Interp *interp,
	int argc,
	Jim_Obj * const *argv)
{
	if (argc != 2) {
		Jim_WrongNumArgs(interp, 1, argv, "ls ?dir?");
		return JIM_ERR;
	}

	const char *name = Jim_GetString(argv[1], NULL);

	DIR *dirp = NULL;
	dirp = opendir(name);
	if (dirp == NULL)
		return JIM_ERR;
	Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0);

	for (;; ) {
		struct dirent *entry = NULL;
		entry = readdir(dirp);
		if (entry == NULL)
			break;

		if ((strcmp(".", entry->d_name) == 0) || (strcmp("..", entry->d_name) == 0))
			continue;

		Jim_ListAppendElement(interp, objPtr,
			Jim_NewStringObj(interp, entry->d_name, strlen(entry->d_name)));
	}
	closedir(dirp);

	Jim_SetResult(interp, objPtr);

	return JIM_OK;
}
开发者ID:01org,项目名称:CODK-A-Flashpack,代码行数:35,代码来源:ioutil.c

示例11: array_cmd_get

static int array_cmd_get(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    Jim_Obj *objPtr = Jim_GetVariable(interp, argv[0], JIM_NONE);

    if (!objPtr) {
        return JIM_OK;
    }

    if (argc == 1 || Jim_CompareStringImmediate(interp, argv[1], "*")) {
        /* Optimise the "all" case */
        if (Jim_IsList(objPtr)) {
            if (Jim_ListLength(interp, objPtr) % 2 != 0) {
                /* A list with an odd number of elements */
                return JIM_ERR;
            }
        }
        else if (Jim_DictSize(interp, objPtr) < 0) {
            /* Can't be converted to a dictionary */
            return JIM_ERR;
        }
        Jim_SetResult(interp, objPtr);
        return JIM_OK;
    }

    /* Return a list of keys and values where the keys match the pattern */
    return Jim_DictValues(interp, objPtr, argv[1]);
}
开发者ID:JimmyDurandWesolowski,项目名称:openocd,代码行数:27,代码来源:jim-array.c

示例12: Win32_AnimateWindow

static int
Win32_AnimateWindow(Jim_Interp *interp, int objc, Jim_Obj *const objv[])
{
    HWND hwnd;
    DWORD dwTime = 0, dwFlags = 0;
    struct map_t { const char* s; DWORD f; };
    
    if (objc != 4) {
        Jim_WrongNumArgs(interp, 1, objv, "windowhandle time flags");
        return JIM_ERR;
    }

    if (Jim_GetLong(interp, objv[1], (long *)&hwnd) != JIM_OK)
        return JIM_ERR;
    if (Jim_GetLong(interp, objv[2], &dwTime) != JIM_OK)
        return JIM_ERR;
    if (GetAnimateWindowFlagsFromObj(interp, objv[3], &dwFlags) != JIM_OK)
        return JIM_ERR;

    if (!AnimateWindow(hwnd, dwTime, dwFlags)) {
        DWORD err = GetLastError();
        Jim_Obj *errObj;
        if (err == ERROR_SUCCESS)
            errObj = Jim_NewStringObj(interp, "error: "
                " calling thread does not own the window", -1);
        else
            errObj = Win32ErrorObj(interp, "AnimateWindow", err);
        Jim_SetResult(interp, errObj);
        return JIM_ERR;
    }
    return JIM_OK;
}
开发者ID:alepharchives,项目名称:Jim,代码行数:32,代码来源:jim-win32.c

示例13: Win32_ShowWindow

static int
Win32_ShowWindow(Jim_Interp *interp, int objc, Jim_Obj *const objv[])
{
    HWND hwnd;
    int cmd;
    const char *cmds[] = { 
        "SW_HIDE", "SW_SHOWNORMAL", "SW_SHOWMINIMIZED", "SW_MAXIMIZE",
        "SW_SHOWNOACTIVATE", "SW_SHOW", "SW_MINIMIZE", "SW_SHOWMINNOACTIVE",
        "SW_SHOWNA", "SW_RESTORE", "SW_SHOWDEFAULT", "SW_FORCEMINIMIZE",
        NULL
    };
    if (objc != 3) {
        Jim_WrongNumArgs(interp, 1, objv, "windowhandle option");
        return JIM_ERR;
    }
    if (Jim_GetLong(interp, objv[1], (long *)&hwnd) != JIM_OK)
        return JIM_ERR;
    if (Jim_GetEnum(interp, objv[2], cmds, &cmd, "command", JIM_ERRMSG) != JIM_OK)
        return JIM_ERR;
    
    
    if (!ShowWindow(hwnd, cmd)) {
        Jim_SetResult(interp,
            Win32ErrorObj(interp, "ShowWindow", GetLastError()));
        return JIM_ERR;
    }
    return JIM_OK;
}
开发者ID:alepharchives,项目名称:Jim,代码行数:28,代码来源:jim-win32.c

示例14: Win32_GetSystemTime

static int
Win32_GetSystemTime(Jim_Interp *interp, int objc, Jim_Obj * const *objv)
{
    Jim_Obj *a[16];
    size_t n = 0;
    SYSTEMTIME t;
    GetSystemTime(&t);

#define JIMADD(name) \
    a[n++] = Jim_NewStringObj(interp, #name, -1); \
    a[n++] = Jim_NewIntObj(interp, t.w ## name )

    JIMADD(Year);
    JIMADD(Month);
    JIMADD(DayOfWeek);
    JIMADD(Day);
    JIMADD(Hour);
    JIMADD(Minute);
    JIMADD(Second);
    JIMADD(Milliseconds);
#undef JIMADD

    Jim_SetResult(interp, Jim_NewListObj(interp, a, n));
    return JIM_OK;
}
开发者ID:hummypkg,项目名称:jimtcl,代码行数:25,代码来源:jim-win32.c

示例15: aio_cmd_filename

static int aio_cmd_filename(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    AioFile *af = Jim_CmdPrivData(interp);

    Jim_SetResult(interp, af->filename);
    return JIM_OK;
}
开发者ID:alex-shpilkin,项目名称:jimtcl,代码行数:7,代码来源:jim-aio.c


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