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

C++ dolibrary函数代码示例

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

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



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

示例1: runargs

static int runargs (lua_State *L, char **argv, int n) {
  int i;
  for (i = 1; i < n; i++) {
    if (argv[i] == NULL) continue;
    lua_assert(argv[i][0] == '-');
    switch (argv[i][1]) {  /* option */
      case 'e': {
        const char *chunk = argv[i] + 2;
        if (*chunk == '\0') chunk = argv[++i];
        lua_assert(chunk != NULL);
        if (dostring(L, chunk, "=(command line)") != 0)
          return 1;
        break;
      }
      case 'l': {
        const char *filename = argv[i] + 2;
        if (*filename == '\0') filename = argv[++i];
        lua_assert(filename != NULL);
        if (dolibrary(L, filename))
          return 1;  /* stop if file fails */
        break;
      }
      default: break;
    }
  }
  return 0;
}
开发者ID:andyvand,项目名称:UltraDefrag,代码行数:27,代码来源:lua.c


示例2: runargs

static int runargs (LUA_State *L, char **argv, int n) {
  int i;
  for (i = 1; i < n; i++) {
    LUA_assert(argv[i][0] == '-');
    switch (argv[i][1]) {  /* option */
      case 'e': {
        const char *chunk = argv[i] + 2;
        if (*chunk == '\0') chunk = argv[++i];
        LUA_assert(chunk != NULL);
        if (dostring(L, chunk, "=(COMMAND LINE)") != LUA_OK)
          return 0;
        break;
      }
      case 'l': {
        const char *filename = argv[i] + 2;
        if (*filename == '\0') filename = argv[++i];
        LUA_assert(filename != NULL);
        if (dolibrary(L, filename) != LUA_OK)
          return 0;  /* stop if file fails */
        break;
      }
      default: break;
    }
  }
  return 1;
}
开发者ID:mniip,项目名称:LUA,代码行数:26,代码来源:LUA.c


示例3: pmain

static int pmain(lua_State *L)
{
    struct Smain *s = &smain;
    char **argv = s->argv;
    int script;
    int flags = 0;
    globalL = L;
    if (argv[0] && argv[0][0]) progname = argv[0];
    LUAJIT_VERSION_SYM();  /* linker-enforced version check */
    script = collectargs(argv, &flags);
    if (script < 0) {  /* invalid args? */
        print_usage();
        s->status = 1;
        return 0;
    }
    if ((flags & FLAGS_NOENV)) {
        lua_pushboolean(L, 1);
        lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
    }
    lua_gc(L, LUA_GCSTOP, 0);  /* stop collector during initialization */
    luaL_openlibs(L);  /* open libraries */
    gsl_shell_openlibs(L);
    lua_gc(L, LUA_GCRESTART, -1);
    dolibrary (L, "gslext");
    s->keep_windows = 1;
    if (!(flags & FLAGS_NOENV)) {
        s->status = handle_luainit(L);
        if (s->status != 0) return 0;
    }
    if (s->status != 0) return 0;
    if ((flags & FLAGS_VERSION)) print_version();
    s->status = runargs(L, argv, (script > 0) ? script : s->argc);
    if (s->status != 0) return 0;
    if (script) {
        s->status = handle_script(L, argv, script);
        if (s->status != 0) return 0;
    }
    if ((flags & FLAGS_INTERACTIVE)) {
        print_jit_status(L);
        dotty(L);
        s->keep_windows = 0;
    } else if (script == 0 && !(flags & (FLAGS_EXEC|FLAGS_VERSION))) {
        if (lua_stdin_is_tty()) {
            print_version();
            print_jit_status(L);
            print_help_message();
            dotty(L);
            s->keep_windows = 0;
        } else {
            dofile(L, NULL);  /* executes stdin as a file */
        }
    }
    return 0;
}
开发者ID:LuaDist,项目名称:gsl-shell,代码行数:54,代码来源:gsl-shell-jit.c


示例4: runargs

/*
** Processes options 'e' and 'l', which involve running Lua code.
** Returns 0 if some code raises an error.
*/
static int runargs (lua_State *L, char **argv, int n) {
  int i;
  for (i = 1; i < n; i++) {
    int option = argv[i][1];
    lua_assert(argv[i][0] == '-');  /* already checked */
    if (option == 'e' || option == 'l') {
      int status;
      const char *extra = argv[i] + 2;  /* both options need an argument */
      if (*extra == '\0') extra = argv[++i];
      lua_assert(extra != NULL);
      status = (option == 'e')
               ? dostring(L, extra, "=(command line)")
               : dolibrary(L, extra);
      if (status != LUA_OK) return 0;
    }
  }
  return 1;
}
开发者ID:Fabio3rs,项目名称:Guitar-PlusPlus,代码行数:22,代码来源:lua.c


示例5: runargs

static int runargs(lua_State *L, char **argv, int n)
{
    int i;
    for (i = 1; i < n; i++) {
        if (argv[i] == NULL) continue;
        lua_assert(argv[i][0] == '-');
        switch (argv[i][1]) {  /* option */
        case 'e': {
            const char *chunk = argv[i] + 2;
            if (*chunk == '\0') chunk = argv[++i];
            lua_assert(chunk != NULL);
            if (dostring(L, chunk, "=(command line)") != 0)
                return 1;
            break;
        }
        case 'l': {
            const char *filename = argv[i] + 2;
            if (*filename == '\0') filename = argv[++i];
            lua_assert(filename != NULL);
            if (dolibrary(L, filename))
                return 1;  /* stop if file fails */
            break;
        }
        case 'j': {  /* LuaJIT extension */
            const char *cmd = argv[i] + 2;
            if (*cmd == '\0') cmd = argv[++i];
            lua_assert(cmd != NULL);
            if (dojitcmd(L, cmd))
                return 1;
            break;
        }
        case 'O':  /* LuaJIT extension */
            if (dojitopt(L, argv[i] + 2))
                return 1;
            break;
        case 'b':  /* LuaJIT extension */
            return dobytecode(L, argv+i);
        default:
            break;
        }
    }
    return 0;
}
开发者ID:LuaDist,项目名称:gsl-shell,代码行数:43,代码来源:gsl-shell-jit.c


示例6: pmain

static int pmain(lua_State *L)
{
	struct Smain *s = (struct Smain *)lua_touserdata(L, 1);
	globalL = L;

	lua_gc(L, LUA_GCSTOP, 0);
	luaL_openlibs(L);
	lua_gc(L, LUA_GCRESTART, 0);
	find_local_libbcc(L);

	s->status = dolibrary(L, "bcc", 0);
	if (s->status)
		return 0;

	lua_pushstring(L, progname);
	lua_setglobal(L, "BCC_STANDALONE_NAME");

	pushargv(L, s->argv, s->argc, 1);
	lua_setglobal(L, "arg");

	s->status = report(L, docall(L, 0, 1));
	return 0;
}
开发者ID:MiauWuffMiau,项目名称:bcc,代码行数:23,代码来源:main.c


示例7: pmain

static int pmain(lua_State *L)
{
	struct Smain *s = &smain;
	char **argv = s->argv;
	int argn;
	int flags = 0;
	globalL = L;
	if (argv[0] && argv[0][0]) progname = argv[0];

	LUAJIT_VERSION_SYM();  /* Linker-enforced version check. */

	argn = collectargs(argv, &flags);
  if (argn < 0) {  /* Invalid args? */
		print_usage();
		s->status = 1;
		return 0;
	}

	if ((flags & FLAGS_NOENV)) {
		lua_pushboolean(L, 1);
		lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
	}

	/* Set MAD env _before_ libraries are open. */
	mad_setenv(L, flags & FLAGS_NOENV);

	/* Stop collector during library initialization. */
	lua_gc(L, LUA_GCSTOP, 0);
	luaL_openlibs(L);
	mad_openlibs(L);
	lua_gc(L, LUA_GCRESTART, -1);

	createargtable(L, argv, s->argc, argn);

	if (!(flags & FLAGS_NOENV)) {
		s->status = handle_luainit(L);
		if (s->status != LUA_OK) return 0;
	}

	/* MAD section. */
	mad_setsig();
	mad_regfunc();

	if ((flags & FLAGS_MADENV))
		dolibrary(L, "madl_main");
	if (!(flags & FLAGS_NOENV)) {
		s->status = handle_madinit(L);
		if (s->status != LUA_OK) return 0;
	}

	if ((flags & FLAGS_VERSION)) print_version();

	s->status = runargs(L, argv, argn);
	if (s->status != LUA_OK) return 0;

	if (s->argc > argn) {
    s->status = handle_script(L, argv + argn);
		if (s->status != LUA_OK) return 0;
	}

	if ((flags & FLAGS_INTERACTIVE)) {
		(void)print_jit_status;
		dotty(L);
	} else if (s->argc == argn && !(flags & FLAGS_EXEC)) {
		if (lua_stdin_is_tty()) {
			(void)print_version;
			(void)print_jit_status;
			dotty(L);
		} else {
			dofile(L, NULL);  /* Executes stdin as a file. */
		}
	}
	return 0;
}
开发者ID:MethodicalAcceleratorDesign,项目名称:MAD,代码行数:74,代码来源:mad_main.c


示例8: handle_argv

static int handle_argv (lua_State *L, int argc, char **argv, int *interactive) {
  if (argv[1] == NULL) {  /* no arguments? */
    *interactive = 0;
    if (lua_stdin_is_tty())
      dotty(L);
    else
      dofile(L, NULL);  /* executes stdin as a file */
  }
  else {  /* other arguments; loop over them */
    int i;
    for (i = 1; argv[i] != NULL; i++) {
      if (argv[i][0] != '-') break;  /* not an option? */
      switch (argv[i][1]) {  /* option */
        case '-': {  /* `--' */
          if (argv[i][2] != '\0') {
            print_usage();
            return 1;
          }
          i++;  /* skip this argument */
          goto endloop;  /* stop handling arguments */
        }
        case '\0': {
          clearinteractive(interactive);
          dofile(L, NULL);  /* executes stdin as a file */
          break;
        }
        case 'i': {
          *interactive = 2;  /* force interactive mode after arguments */
          break;
        }
        case 'v': {
          clearinteractive(interactive);
          print_version();
          break;
        }
        case 'e': {
          const char *chunk = argv[i] + 2;
          clearinteractive(interactive);
          if (*chunk == '\0') chunk = argv[++i];
          if (chunk == NULL) {
            print_usage();
            return 1;
          }
          if (dostring(L, chunk, "=(command line)") != 0)
            return 1;
          break;
        }
        case 'l': {
          const char *filename = argv[i] + 2;
          if (*filename == '\0') filename = argv[++i];
          if (filename == NULL) {
            print_usage();
            return 1;
          }
          if (dolibrary(L, filename))
            return 1;  /* stop if file fails */
          break;
        }
        default: {
          clearinteractive(interactive);
          print_usage();
          return 1;
        }
      }
    } endloop:
    if (argv[i] != NULL) {
      int status;
      const char *filename = argv[i];
      int narg = getargs(L, argc, argv, i);  /* collect arguments */
      lua_setglobal(L, "arg");
      clearinteractive(interactive);
      status = luaL_loadfile(L, filename);
      lua_insert(L, -(narg+1));
      if (status == 0)
        status = docall(L, narg, 0);
      else
        lua_pop(L, narg);      
      return report(L, status);
    }
  }
  return 0;
}
开发者ID:LuaDist,项目名称:oil,代码行数:82,代码来源:console.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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