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

C++ dooptions函数代码示例

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

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



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

示例1: ll_module

static int ll_module (lua_State *L) {
  const char* modname = luaL_checkstring(L, 1);
  int loaded = lua_gettop(L) + 1;  /* index of _LOADED table */
  lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
  lua_getfield(L, loaded, modname);  /* get _LOADED[modname] */
  if (!lua_istable(L, -1)) {  /* not found? */
    lua_pop(L, 1);  /* remove previous result */
    /* try global variable (and create one if it does not exist) */
    if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != nullptr)
      return luaL_error(L, "name conflict for module " LUA_QS, modname);
    lua_pushvalue(L, -1);
    lua_setfield(L, loaded, modname);  /* _LOADED[modname] = new table */
  }
  /* check whether table already has a _NAME field */
  lua_getfield(L, -1, "_NAME");
  if (!lua_isnil(L, -1))  /* is table an initialized module? */
    lua_pop(L, 1);
  else {  /* no; initialize it */
    lua_pop(L, 1);
    modinit(L, modname);
  }
  lua_pushvalue(L, -1);
  setfenv(L);
  dooptions(L, loaded - 1);
  return 0;
}
开发者ID:Isaacssv552,项目名称:ufoai,代码行数:26,代码来源:loadlib.cpp


示例2: ll_module

static int ll_module (lua_State *L) {
  const char *modname = luaL_checkstring(L, 1);
  int lastarg = lua_gettop(L);  /* last parameter */
  luaL_pushmodule(L, modname, 1);  /* get/create module table */
  /* check whether table already has a _NAME field */
  if (lua_getfield(L, -1, "_NAME") != LUA_TNIL)
    lua_pop(L, 1);  /* table is an initialized module */
  else {  /* no; initialize it */
    lua_pop(L, 1);
    modinit(L, modname);
  }
  lua_pushvalue(L, -1);
  set_env(L);
  dooptions(L, lastarg);
  return 1;
}
开发者ID:littlesome,项目名称:xLua,代码行数:16,代码来源:loadlib.c


示例3: lj_cf_package_module

static int lj_cf_package_module(lua_State *L)
{
  const char *modname = luaL_checkstring(L, 1);
  int lastarg = (int)(L->top - L->base);
  luaL_pushmodule(L, modname, 1);
  lua_getfield(L, -1, "_NAME");
  if (!lua_isnil(L, -1)) {  /* Module already initialized? */
    lua_pop(L, 1);
  } else {
    lua_pop(L, 1);
    modinit(L, modname);
  }
  lua_pushvalue(L, -1);
  setfenv(L);
  dooptions(L, lastarg);
  return LJ_52;
}
开发者ID:rampantpixels,项目名称:lua_lib,代码行数:17,代码来源:lib_package.c


示例4: dooptions

int
dooptions(int argc, char** argv)
/*
 * dooptions is called to process command line arguments (-Detc).
 * It is called only at cpp startup.
 */
{
        register char           *ap;
        register DEFBUF         *dp;
        register int            c;
        int                     i, j;
        char                    *arg;
        SIZES                   *sizp;          /* For -S               */
        int                     size;           /* For -S               */
        int                     isdatum;        /* FALSE for -S*        */
        int                     endtest;        /* For -S               */

        for (i = j = 1; i < argc; i++) {
            arg = ap = argv[i];

            if (*ap++ != '-' || *ap == EOS)
            {
                    argv[j++] = argv[i];
            }
            else {
                c = *ap++;                      /* Option byte          */
                if (islower(c))                 /* Normalize case       */
                    c = toupper(c);
                switch (c) {                    /* Command character    */
                case 'C':                       /* Keep comments        */
                    cflag = TRUE;
                    keepcomments = TRUE;
                    break;

                case 'D':                       /* Define symbol        */
                    /*
                     * If the option is just "-Dfoo", make it -Dfoo=1
                     */
                    while (*ap != EOS && *ap != '=')
                        ap++;
                    if (*ap == EOS)
                        ap = "1";
                    else
                        *ap++ = EOS;
                    /*
                     * Now, save the word and its definition.
                     */
                    dp = defendel(argv[i] + 2, FALSE);
                    dp->repl = savestring(ap);
                    dp->nargs = DEF_NOARGS;
                    break;

                case 'E':                       /* Ignore non-fatal     */
                    eflag = TRUE;               /* errors.              */
                    break;

                case 'I':                       /* Include directory    */
                    AddInclude( ap );           /* BP, 11.09.91 */
                    break;

                case 'N':                       /* No predefineds       */
                    nflag++;                    /* Repeat to undefine   */
                    break;                      /* __LINE__, etc.       */

                case 'S':
                    sizp = size_table;
                    if (0 != (isdatum = (*ap != '*'))) /* If it's just -S,     */
                        endtest = T_FPTR;       /* Stop here            */
                    else {                      /* But if it's -S*      */
                        ap++;                   /* Step over '*'        */
                        endtest = 0;            /* Stop at end marker   */
                    }
                    while (sizp->bits != endtest && *ap != EOS) {
                        if (!isdigit(*ap)) {    /* Skip to next digit   */
                            ap++;
                            continue;
                        }
                        size = 0;               /* Compile the value    */
                        while (isdigit(*ap)) {
                            size *= 10;
                            size += (*ap++ - '0');
                        }
                        if (isdatum)
                            sizp->size = size;  /* Datum size           */
                        else
                            sizp->psize = size; /* Pointer size         */
                        sizp++;
                    }
                    if (sizp->bits != endtest)
                        cwarn("-S, too few values specified in %s", argv[i]);
                    else if (*ap != EOS)
                        cwarn("-S, too many values, \"%s\" unused", ap);
                    break;

                case 'U':                       /* Undefine symbol      */
                    if (defendel(ap, TRUE) == NULL)
                        cwarn("\"%s\" wasn't defined", ap);
                    break;

#if OSL_DEBUG_LEVEL > 1
//.........这里部分代码省略.........
开发者ID:cjapes,项目名称:core,代码行数:101,代码来源:cpp3.c


示例5: readoptions

int readoptions(char* filename, char*** pfargv)
{
    FILE* fp;
    int c;
    int bInQuotes = 0;
    char optbuff[1024];
    char* poptbuff;
    int fargc=0;
    int back;
    char* fargv[PARALIMIT];
    char** pfa;

    pfa = *pfargv = malloc(sizeof(fargv));

    poptbuff = &optbuff[0];
    filename++;
    if ((fp = fopen(filename, "r")) == NULL)
    {
#if OSL_DEBUG_LEVEL > 1
        if ( debug || !bDumpDefs )
            perror(filename);
#endif
        return (FALSE);
    }
    do
    {
        /*
         *  #i27914# double ticks '"' now have a duplicate function:
         *  1. they define a string ( e.g. -DFOO="baz" )
         *  2. a string can contain spaces, so -DFOO="baz zum" defines one
         *  argument no two !
         */
        c = fgetc(fp);
        if ( c != ' ' && c != CR && c != NL && c != HT && c != EOF)
        {
            *poptbuff++ = (char)c;
            if( c == '"' )
                bInQuotes = ~bInQuotes;
        }
        else
        {
            if( c != EOF && bInQuotes )
                *poptbuff++ = (char)c;
            else
            {
                *poptbuff = EOS;
                if (strlen(optbuff)>0)
                {
                    pfa[fargc + 1] = strdup(optbuff);
                    fargc++;
                    pfa[fargc + 1] = 0;
                    poptbuff = &optbuff[0];
                }
            }
        }
    }
    while ( c != EOF );

    fclose(fp);
    back=dooptions(fargc+1,pfa);

    return (back);
}
开发者ID:StefanBruens,项目名称:core,代码行数:63,代码来源:cpp3.c


示例6: MAIN

int MAIN(int argc, char** argv)
{
    int    i;
    char** useargv;
    char** pfargv;

    if( nRunde == 0 )
    {
        pCppIn = stdin;
        pCppOut = stdout;
    }

    nRunde++;
    InitCpp1();
    InitCpp2();
    InitCpp3();
    InitCpp4();
    InitCpp5();
    InitCpp6();

#if HOST == SYS_VMS
    argc = getredirection(argc, argv);      /* vms >file and <file  */
#endif
    initdefines();                          /* O.S. specific def's  */
    if ( argv[argc-1][0] == '@' )
    {
        i = readoptions( argv[1], &pfargv );    /* Command file */
        useargv=pfargv;
    }
    else
    {
        i = dooptions(argc, argv);              /* Command line -flags  */
        useargv=argv;
    }
    switch (i)
    {
#if OSL_DEBUG_LEVEL > 1
    case 4:
        if ( bDumpDefs )
        {
            /*
             * Get defBase file, "-" means use stdout.
             */
            if (!streq(useargv[3], "-"))
            {
#if HOST == SYS_VMS
                /*
                 * On vms, reopen stdout with "vanilla rms" attributes.
                 */
                if ((i = creat(useargv[3], 0, "rat=cr", "rfm=var")) == -1
                    || dup2(i, fileno(stdout)) == -1)
#else
                pDefOut = fopen( useargv[3], "w" );
                if( pDefOut == NULL )
#endif
                {
                    perror(useargv[3]);
                    cerror("Can't open output file \"%s\"", useargv[3]);
                    exit(IO_ERROR);
                }
            }                           /* Continue by opening output    */
        }
#endif
    case 3:
        /*
         * Get output file, "-" means use stdout.
         */
        if (!streq(useargv[2], "-"))
        {
#if HOST == SYS_VMS
            /*
             * On vms, reopen stdout with "vanilla rms" attributes.
             */
            if ((i = creat(useargv[2], 0, "rat=cr", "rfm=var")) == -1
                || dup2(i, fileno(stdout)) == -1)
#else
            pCppOut = fopen( useargv[2], "w" );
            if( pCppOut == NULL )
#endif
            {
                perror(useargv[2]);
                cerror("Can't open output file \"%s\"", useargv[2]);
                exit(IO_ERROR);
            }
        }                           /* Continue by opening input    */
    case 2:                         /* One file -> stdin            */
        /*
         * Open input file, "-" means use stdin.
         */
        if (!streq(useargv[1], "-"))
        {
            pCppIn = fopen( useargv[1], "r" );
            if( pCppIn == NULL)
            {
                perror(useargv[1]);
                cerror("Can't open input file \"%s\"", useargv[1]);
                exit(IO_ERROR);
            }
            strncpy(work, useargv[1], NWORK);  /* Remember input filename      */
            break;
//.........这里部分代码省略.........
开发者ID:Echo360,项目名称:LibreOffice-core,代码行数:101,代码来源:cpp1.c


示例7: fppPreProcess

int fppPreProcess(struct fppTag *tags)
{
  int i=0;
  ReturnCode ret;       /* cpp return code */
  struct Global *global;

  global=(struct Global *)malloc(sizeof(struct Global));
  if(!global)
    return(FPP_OUT_OF_MEMORY);

  memset(global, 0, sizeof(struct Global));

  global->infile=NULL;
  global->line=0;
  global->wrongline=0;
  global->errors=0;
  global->recursion=0;
  global->rec_recover=TRUE;
  global->instring=FALSE;
  global->inmacro=FALSE;
  global->workp=NULL;
  global->keepcomments = FALSE;  /* Write out comments flag     */
  global->cflag = FALSE;          /* -C option (keep comments)    */
  global->eflag = FALSE;          /* -E option (never fail)       */
  global->nflag = 0;              /* -N option (no predefines)    */
  global->wflag = FALSE;          /* -W option (write #defines)   */

  global->ifstack[0]=TRUE;       /* #if information     */
  global->ifptr = global->ifstack;
  global->incend = global->incdir;

  /* names defined at cpp start */
  global->preset[0]="frexxcpp"; /* This is the Frexx cpp program */
#if defined( unix )
  global->preset[1]="unix";
  global->preset[2]= NULL;
#endif

  /* Note: order is important   */
  global->magic[0] = "__LINE__";
  global->magic[1] = "__FILE__";
  global->magic[2] = "__FUNCTION__";
  global->magic[3] = "__FUNC_LINE__";
  global->magic[4] = NULL;                        /* Must be last       */

  global->funcline = 0;

  global->cplusplus=1;
  global->sharpfilename=NULL;

  global->parmp=NULL;
  global->nargs=0;

  global->macro=NULL;
  global->evalue=0;

  global->error=NULL;
  global->first_file=NULL;

  global->linelines=TRUE;
  global->warnillegalcpp = FALSE;
  global->outputLINE = TRUE;
  global->warnnoinclude = TRUE;
  global->showversion = TRUE;
  global->showincluded = FALSE;
  global->showspace = FALSE;
  global->nestcomments = FALSE;
  global->warnnestcomments = FALSE;
  global->outputfile = TRUE;
  global->included = 0;

  global->comment = FALSE;
  global->rightconcat = FALSE;
  global->work[0] = '\0';
  global->initialfunc = NULL;

  memset(global->symtab, 0, SBSIZE * sizeof(DEFBUF *));

  ret=initdefines(global);  /* O.S. specific def's  */
  if(ret)
    return(ret);
  dooptions(global, tags);  /* Command line -flags  */
  ret=addfile(global, global->inputio, global->work); /* "open" main input file       */

  global->out = global->outputfile;

  if(!ret)
    ret=cppmain(global);             /* Process main file            */
  if ((i = (int)(global->ifptr - global->ifstack)) != 0) {
#if OLD_PREPROCESSOR
    cwarn(global, ERROR_IFDEF_DEPTH, i);
#else
    cerror(global, ERROR_IFDEF_DEPTH, i);
#endif
  }

  if (global->errors > 0 && !global->eflag)
    return(IO_ERROR);
  return(IO_NORMAL);       /* No errors or -E option set   */
}
开发者ID:kwertz,项目名称:fcpp,代码行数:100,代码来源:cpp1.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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