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

C++ Jim_WrongNumArgs函数代码示例

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

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



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

示例1: Jim_SleepCmd

static int Jim_SleepCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    int ret;

    if (argc != 2) {
        Jim_WrongNumArgs(interp, 1, argv, "seconds");
        return JIM_ERR;
    }
    else {
        double t;

        ret = Jim_GetDouble(interp, argv[1], &t);
        if (ret == JIM_OK) {

#ifdef HAVE_SELECT
            struct timeval s;
            s.tv_sec = (long)t;
            s.tv_usec = (long)((t - (int)t) * 1e6);
            select(0, NULL, NULL, NULL, &s);
#else
#ifdef HAVE_USLEEP
            usleep((int)((t - (int)t) * 1e6));
#endif
            sleep(t);
#endif
        }
    }

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


示例2: Jim_AlarmCmd

static int Jim_AlarmCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    int ret;

    if (argc != 2) {
        Jim_WrongNumArgs(interp, 1, argv, "seconds");
        return JIM_ERR;
    }
    else {
#ifdef HAVE_UALARM
        double t;

        ret = Jim_GetDouble(interp, argv[1], &t);
        if (ret == JIM_OK) {
            if (t < 1) {
                ualarm(t * 1e6, 0);
            }
            else {
                alarm(t);
            }
        }
#else
        long t;

        ret = Jim_GetLong(interp, argv[1], &t);
        if (ret == JIM_OK) {
            alarm(t);
        }
#endif
    }

    return ret;
}
开发者ID:dgsb,项目名称:jimtcl,代码行数:33,代码来源:jim-signal.c


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


示例4: JimELUpdateCommand

static int JimELUpdateCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    Jim_EventLoop *eventLoop = Jim_CmdPrivData(interp);
    static const char * const options[] = {
        "idletasks", NULL
    };
    enum { UPDATE_IDLE, UPDATE_NONE };
    int option = UPDATE_NONE;
    int flags = JIM_TIME_EVENTS;

    if (argc == 1) {
        flags = JIM_ALL_EVENTS;
    }
    else if (argc > 2 || Jim_GetEnum(interp, argv[1], options, &option, NULL, JIM_ERRMSG | JIM_ENUM_ABBREV) != JIM_OK) {
        Jim_WrongNumArgs(interp, 1, argv, "?idletasks?");
        return JIM_ERR;
    }

    eventLoop->suppress_bgerror = 0;

    while (Jim_ProcessEvents(interp, flags | JIM_DONT_WAIT) > 0) {
    }

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


示例5: JimVariableCmd

static int JimVariableCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    int retcode = JIM_OK;

    if (argc > 3) {
        Jim_WrongNumArgs(interp, 1, argv, "name ?value?");
        return JIM_ERR;
    }
    if (argc > 1) {
        Jim_Obj *targetNameObj;
        Jim_Obj *localNameObj;

        targetNameObj = JimCanonicalNamespace(interp, interp->framePtr->nsObj, argv[1]);

        localNameObj = Jim_NamespaceTail(interp, argv[1]);
        Jim_IncrRefCount(localNameObj);
        if (interp->framePtr->level != 0 || Jim_Length(interp->framePtr->nsObj) != 0) {
            retcode = Jim_CreateNamespaceVariable(interp, localNameObj, targetNameObj);
        }

        /* Set the variable via the local name */
        if (retcode == JIM_OK && argc > 2) {
            retcode = Jim_SetVariable(interp, localNameObj, argv[2]);
        }
        Jim_DecrRefCount(interp, localNameObj);
    }
    return retcode;
}
开发者ID:BitThunder,项目名称:bitthunder,代码行数:28,代码来源:jim-namespace.c


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


示例7: Jim_SleepCmd

static int Jim_SleepCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    int ret;

    if (argc != 2) {
        Jim_WrongNumArgs(interp, 1, argv, "seconds");
        return JIM_ERR;
    }
    else {
        double t;

        ret = Jim_GetDouble(interp, argv[1], &t);
        if (ret == JIM_OK) {
#ifdef HAVE_USLEEP
            if (t < 1) {
                usleep(t * 1e6);
            }
            else
#endif
                sleep(t);
        }
    }

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


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


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


示例10: JimVariableCmd

static int JimVariableCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    int retcode = JIM_OK;

    if (argc > 3) {
        Jim_WrongNumArgs(interp, 1, argv, "name ?value?");
        return JIM_ERR;
    }
    if (argc > 1) {
        Jim_Obj *targetNameObj;
        Jim_Obj *localNameObj;

#if 0
        /* XXX should we give an error on dict sugar syntax? */
        if (JimValidName(interp, "variable", argv[1]) != JIM_OK) {
            return JIM_ERR;
        }
#endif

        targetNameObj = JimCanonicalNamespace(interp, interp->framePtr->nsObj, argv[1]);

        localNameObj = Jim_NamespaceTail(interp, argv[1]);
        Jim_IncrRefCount(localNameObj);
        if (interp->framePtr->level != 0 || Jim_Length(interp->framePtr->nsObj) != 0) {
            Jim_CreateNamespaceVariable(interp, localNameObj, targetNameObj);
        }

        /* Set the variable via the local name */
        if (argc > 2) {
            retcode = Jim_SetVariable(interp, localNameObj, argv[2]);
        }
        Jim_DecrRefCount(interp, localNameObj);
    }
    return retcode;
}
开发者ID:JimmyDurandWesolowski,项目名称:openocd,代码行数:35,代码来源:jim-namespace.c


示例11: JimAioOpenCommand

static int JimAioOpenCommand(Jim_Interp *interp, int argc,
        Jim_Obj *const *argv)
{
    const char *mode;
    const char *filename;

    if (argc != 2 && argc != 3) {
        Jim_WrongNumArgs(interp, 1, argv, "filename ?mode?");
        return JIM_ERR;
    }

    mode = (argc == 3) ? Jim_String(argv[2]) : "r";
    filename = Jim_String(argv[1]);

#ifdef jim_ext_tclcompat
    /* If the filename starts with '|', use popen instead */
    if (*filename == '|') {
        Jim_Obj *evalObj[3];

        evalObj[0] = Jim_NewStringObj(interp, "popen", -1);
        evalObj[1] = Jim_NewStringObj(interp, filename + 1, -1);
        evalObj[2] = Jim_NewStringObj(interp, mode, -1);

        return Jim_EvalObjVector(interp, 3, evalObj);
    }
#endif
    return JimMakeChannel(interp, NULL, -1, argv[1], "aio.handle%ld", 0, mode);
}
开发者ID:alex-shpilkin,项目名称:jimtcl,代码行数:28,代码来源:jim-aio.c


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


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


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


示例15: JimELVwaitCommand

static int JimELVwaitCommand(Jim_Interp *interp, int argc, 
        Jim_Obj *const *argv)
{
    Jim_Obj *oldValue;

    if (argc != 2) {
        Jim_WrongNumArgs(interp, 1, argv, "name");
        return JIM_ERR;
    }
    oldValue = Jim_GetGlobalVariable(interp, argv[1], JIM_NONE);
    if (oldValue) Jim_IncrRefCount(oldValue);
    while (1) {
        Jim_Obj *currValue;

        Jim_ProcessEvents(interp, JIM_ALL_EVENTS);
        currValue = Jim_GetGlobalVariable(interp, argv[1], JIM_NONE);
        /* Stop the loop if the vwait-ed variable changed value,
         * or if was unset and now is set (or the contrary). */
        if ((oldValue && !currValue) ||
            (!oldValue && currValue) ||
            (oldValue && currValue &&
             !Jim_StringEqObj(oldValue, currValue, JIM_CASESENS)))
            break;
    }
    if (oldValue) Jim_DecrRefCount(interp, oldValue);
    return JIM_OK;
}
开发者ID:unnamet,项目名称:estick-jtag,代码行数:27,代码来源:jim-eventloop.c


示例16: Jim_LoadCoreCommand

/* [load] */
static int Jim_LoadCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    if (argc < 2) {
        Jim_WrongNumArgs(interp, 1, argv, "libaryFile");
        return JIM_ERR;
    }
    return Jim_LoadLibrary(interp, Jim_String(argv[1]));
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:9,代码来源:jim-load.c


示例17: JimRlAddHistoryCommand

static int JimRlAddHistoryCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    if (argc != 2) {
        Jim_WrongNumArgs(interp, 1, argv, "string");
        return JIM_ERR;
    }
    add_history(Jim_String(argv[1]));
    return JIM_OK;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:9,代码来源:jim-readline.c


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


示例19: CountCharsFunc

/*
 * Our function.
 */
static int
CountCharsFunc(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
	if (argc != 2) {
		Jim_WrongNumArgs(interp, 1, argv, "string");
		return (JIM_ERR);
	}
	Jim_SetResult(interp, Jim_NewIntObj(interp, Jim_Length(argv[1])));
	return (JIM_OK);
}
开发者ID:BitThunder,项目名称:bitthunder,代码行数:13,代码来源:jim_return.c


示例20: Jim_PosixPidCommand

static int Jim_PosixPidCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    if (argc != 1) {
        Jim_WrongNumArgs(interp, 1, argv, "");
        return JIM_ERR;
    }

    Jim_SetResultInt(interp, getpid());
    return JIM_OK;
}
开发者ID:marrero,项目名称:jimtcl,代码行数:10,代码来源:jim-posix.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Jnew函数代码示例发布时间:2022-05-30
下一篇:
C++ Jim_SetResultString函数代码示例发布时间: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