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

C++ skip_spaces函数代码示例

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

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



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

示例1: skip_spaces

//--------------------------------------------------------------------------
bool groupman_t::parse_nodeset(
      psupergroup_t sg,
      char *grpstr)
{
  // Find node group bounds
  for ( /*init*/ char *p_group_start = NULL, *p_group_end = NULL;
        /* cond*/(p_group_start = strchr(grpstr, '(')) != NULL
             && (p_group_start = skip_spaces(p_group_start+1), (p_group_end = strchr(p_group_start, ')')) != NULL);
        /*incr*/)
  {
    // Terminate the string with the closing parenthesis
    *p_group_end = '\0';

    // Advance to next group
    grpstr = skip_spaces(p_group_end + 1);

    // Add a new group
    pnodegroup_t ng = sg->add_nodegroup();

    for (/*init*/ char *saved_ptr, 
                  *p = p_group_start, 
                  *token = qstrtok(p, ",", &saved_ptr);
         /*cond*/ p != NULL;
         /*incr*/ p = qstrtok(NULL, ",", &saved_ptr))
    {
      p = skip_spaces(p);

      int nid;
      ea_t start = 0, end = 0;
      if (qsscanf(p, "%d : %a : %a", &nid, &start, &end) <= 0)
        continue;

      // Create an ND
      nodedef_t *nd = ng->add_node();
      nd->nid = nid;
      nd->start = start;
      nd->end = end;

      // Map this node
      map_nodedef(nid, nd);
    }
  }
  return true;
}
开发者ID:lallousx86,项目名称:GraphSlick,代码行数:45,代码来源:groupman.cpp


示例2: perform_net_load

void
perform_net_load(struct descriptor_data *d, char *arg)
{
    int skill_num, percent;
    long int cost;

    skip_spaces(&arg);
    if (!*arg) {
        d_printf(d, "Usage: load <program>\r\n");
        return;
    }

    skill_num = find_skill_num(arg);
    if (skill_num < 1) {
        d_printf(d, "Error: program '%s' not found\r\n", arg);
        return;
    }

    if ((SPELL_GEN(skill_num, CLASS_CYBORG) > 0
            && GET_CLASS(d->creature) != CLASS_CYBORG)
        || (GET_REMORT_GEN(d->creature) < SPELL_GEN(skill_num, CLASS_CYBORG))
        || (GET_LEVEL(d->creature) < SPELL_LEVEL(skill_num, CLASS_CYBORG))) {
        d_printf(d, "Error: resources unavailable to load '%s'\r\n", arg);
        return;
    }

    if (GET_SKILL(d->creature, skill_num) >= LEARNED(d->creature)) {
        d_printf(d, "Program fully installed on local system.\r\n");
        return;
    }

    cost = GET_SKILL_COST(d->creature, skill_num);
    d_printf(d, "Program cost: %10ld  Account balance; %'" PRId64 "\r\n",
        cost, d->account->bank_future);

    if (d->account->bank_future < cost) {
        d_printf(d, "Error: insufficient funds in your account\r\n");
        return;
    }

    withdraw_future_bank(d->account, cost);
    percent = MIN(MAXGAIN(d->creature),
        MAX(MINGAIN(d->creature), GET_INT(d->creature) * 2));
    percent = MIN(LEARNED(d->creature) -
        GET_SKILL(d->creature, skill_num), percent);
    SET_SKILL(d->creature, skill_num, GET_SKILL(d->creature,
            skill_num) + percent);
    d_printf(d,
        "Program download: %s terminating, %d percent transfer.\r\n",
        spell_to_str(skill_num), percent);
    if (GET_SKILL(d->creature, skill_num) >= LEARNED(d->creature))
        d_printf(d, "Program fully installed on local system.\r\n");
    else
        d_printf(d, "Program %d%% installed on local system.\r\n",
            GET_SKILL(d->creature, skill_num));
}
开发者ID:TempusMUD,项目名称:Tempuscode,代码行数:56,代码来源:gnetsys.c


示例3: skip_spaces

void config_file::init(const string& filename, istream& is)
{
  string cur_sect;

  int lineno = 1;
  for (string line; getline(is, line); ++lineno) {
    const char* p = line.c_str();
    const char* st = p;
    p = skip_spaces(p);

    if (*p=='\0') continue;
    if (*p==';') continue;

    if (*p=='[') {
      const char* q = strchr(p, ']');
      if (q == NULL)
        throw parse_error(filename, lineno, line.length(), "']' missing");
      cur_sect = string(p+1, q);
      q = skip_spaces(q+1);
      if (*q != '\0') 
        throw parse_error(filename, lineno, q-st, "invalid character");

      (void)dat[cur_sect];

      continue;
    }

    const char* q = strchr(p, '=');
    if (q == NULL)
      throw parse_error(filename, lineno, line.length(), "'=' missing");

    string key(trim(string(p, q)));
    string val(trim(q+1));

    if (val.length() >= 2) {
      if (val[0] == '"' &&
          val[val.length()-1] == '"')
        val.assign(val, 1, val.length()-2);
    }

    dat[cur_sect][key] = val;
  }
}
开发者ID:b-xiang,项目名称:pficommon,代码行数:43,代码来源:config_file.cpp


示例4: check_newline

static int check_newline(struct dsa *dsa)
{     if (skip_spaces(dsa, 0)) return 1;
      if (!(dsa->c == EOF || dsa->c == '\n'))
      {  xprintf("%s:%d: extra symbols detected\n", dsa->fname,
            dsa->seqn);
         return 1;
      }
      if (get_char(dsa)) return 1;
      return 0;
}
开发者ID:BohanHsu,项目名称:developer,代码行数:10,代码来源:glptsp.c


示例5: check_colon

static int check_colon(struct dsa *dsa)
{     if (skip_spaces(dsa, 0)) return 1;
      if (dsa->c != ':')
      {  xprintf("%s:%d: missing colon after `%s'\n", dsa->fname,
            dsa->seqn, dsa->token);
         return 1;
      }
      if (get_char(dsa)) return 1;
      return 0;
}
开发者ID:BohanHsu,项目名称:developer,代码行数:10,代码来源:glptsp.c


示例6: fs_cmd_user

static int fs_cmd_user(struct fs_info *session) {
	/* Usage: user <user-name> */
	int ret;
	char *tmp, *arg_username, *password;

	if (!session->is_connected) {
		fprintf(stderr, "Not connected.\n");
		return FTP_RET_FAIL;
	}

	/* Get args */
	tmp = &session->cmd_buff[0];
	skip_spaces(tmp); skip_word(tmp); skip_spaces(tmp);
	arg_username = tmp;

	split_word(arg_username);

	if (*arg_username == '\0') {
		fprintf(stderr, "User name is not specified.\n");
		errno = EINVAL;
		return FTP_RET_ERROR;
	}
	/* --- END OF Get args --- */

	ret = fs_execute(session, "USER %s\r\n", arg_username);
	if (ret != FTP_RET_OK) {
		return ret;
	}

	password = getpass("Password: ");
	if (password == NULL) {
		fprintf(stderr, "Cant get password for %s.\n", arg_username);
		errno = EINVAL;
		return FTP_RET_ERROR;
	}

	ret = fs_execute(session, "PASS %s\r\n", password);
	if (ret != FTP_RET_OK) {
		return ret;
	}

	return FTP_RET_OK;
}
开发者ID:AleksandraButrova,项目名称:embox,代码行数:43,代码来源:ftp.c


示例7: createToken

Token *ScannerImp::nextToken() {
	if(skip_spaces())return NULL;
	runMachines();
	TType typ = manager->getType();
	skip_comment(&typ);
	int wortlaenge = manager->getLexemLength();
	int wrongChars = manager->ungetCtr();
	buffer->ungetChar(wrongChars);
	return createToken(typ,wortlaenge,x,y);
}
开发者ID:fble,项目名称:hochschule,代码行数:10,代码来源:ScannerImp.cpp


示例8: simple_strtoul

char *spk_s2uchar(char *start, char *dest)
{
	int val;

	/* Do not replace with kstrtoul: here we need start to be updated */
	val = simple_strtoul(skip_spaces(start), &start, 10);
	if (*start == ',')
		start++;
	*dest = (u_char)val;
	return start;
}
开发者ID:Anjali05,项目名称:linux,代码行数:11,代码来源:varhandlers.c


示例9: empty_elsed

static inline int empty_elsed(const char *in)
{
	in = skip_spaces(in);
	in += LEN("#elsed");
	while (*in == ' ' || *in == '\t')
		in++;
	if (*in == '\n')
		return 1;
	else
		return 0;
}
开发者ID:initng,项目名称:initng-scripts,代码行数:11,代码来源:install_service_file.c


示例10: parse

	void parse(const char* json, JsonObject& object)
	{
		CE_ASSERT_NOT_NULL(json);

		json = skip_spaces(json);

		if (*json == '{')
			parse_object(json, object);
		else
			parse_root_object(json, object);
	}
开发者ID:MAnyKey,项目名称:crown,代码行数:11,代码来源:sjson.cpp


示例11: while

void ScannerImp::skip_comment(TType *typ) {
	if(*typ == CommentBegin) {
		while (*typ != CommentEnd || skip_spaces()) {
			runMachines();
			*typ = manager->getType();
		}
		buffer->ungetChar(1);
		runMachines();
		*typ = manager->getType();
	}
}
开发者ID:fble,项目名称:hochschule,代码行数:11,代码来源:ScannerImp.cpp


示例12: parse

	void parse(const char* json, JsonObject& object)
	{
		CE_ENSURE(NULL != json);

		json = skip_spaces(json);

		if (*json == '{')
			parse_object(json, object);
		else
			parse_root_object(json, object);
	}
开发者ID:neuroradiology,项目名称:crown,代码行数:11,代码来源:sjson.cpp


示例13: get_number_or_range

int
get_number_or_range (struct get_number_or_range_state *state)
{
  if (*state->string != '-')
    {
      /* Default case: state->string is pointing either to a solo
	 number, or to the first number of a range.  */
      state->last_retval = get_number_trailer (&state->string, '-');
      if (*state->string == '-')
	{
	  char **temp;

	  /* This is the start of a range (<number1> - <number2>).
	     Skip the '-', parse and remember the second number,
	     and also remember the end of the final token.  */

	  temp = &state->end_ptr; 
	  state->end_ptr = skip_spaces (state->string + 1);
	  state->end_value = get_number (temp);
	  if (state->end_value < state->last_retval) 
	    {
	      error (_("inverted range"));
	    }
	  else if (state->end_value == state->last_retval)
	    {
	      /* Degenerate range (number1 == number2).  Advance the
		 token pointer so that the range will be treated as a
		 single number.  */ 
	      state->string = state->end_ptr;
	    }
	  else
	    state->in_range = 1;
	}
    }
  else if (! state->in_range)
    error (_("negative value"));
  else
    {
      /* state->string points to the '-' that betokens a range.  All
	 number-parsing has already been done.  Return the next
	 integer value (one greater than the saved previous value).
	 Do not advance the token pointer until the end of range
	 is reached.  */

      if (++state->last_retval == state->end_value)
	{
	  /* End of range reached; advance token pointer.  */
	  state->string = state->end_ptr;
	  state->in_range = 0;
	}
    }
  state->finished = *state->string == '\0';
  return state->last_retval;
}
开发者ID:5kg,项目名称:gdb,代码行数:54,代码来源:cli-utils.c


示例14: dm_substitute_devices

static void __init dm_substitute_devices(char *str, size_t str_len)
{
	char *candidate = str;
	char *candidate_end = str;
	char old_char;
	size_t len = 0;
	dev_t dev;

	if (str_len < 3)
		return;

	while (str && *str) {
		candidate = strchr(str, '/');
		if (!candidate)
			break;

		/* Avoid embedded slashes */
		if (candidate != str && *(candidate - 1) != DM_FIELD_SEP) {
			str = strchr(candidate, DM_FIELD_SEP);
			continue;
		}

		len = get_dm_option(candidate, &candidate_end, DM_FIELD_SEP);
		str = skip_spaces(candidate_end);
		if (len < 3 || len > 37)  /* name_to_dev_t max; maj:mix min */
			continue;

		/* Temporarily terminate with a nul */
		candidate_end--;
		old_char = *candidate_end;
		*candidate_end = '\0';

		DMDEBUG("converting candidate device '%s' to dev_t", candidate);
		/* Use the boot-time specific device naming */
		dev = name_to_dev_t(candidate);
		*candidate_end = old_char;

		DMDEBUG(" -> %u", dev);
		/* No suitable replacement found */
		if (!dev)
			continue;

		/* Rewrite the /dev/path as a major:minor */
		len = snprintf(candidate, len, "%u:%u", MAJOR(dev), MINOR(dev));
		if (!len) {
			DMERR("error substituting device major/minor.");
			break;
		}
		candidate += len;
		/* Pad out with spaces (fixing our nul) */
		while (candidate < candidate_end)
			*(candidate++) = DM_FIELD_SEP;
	}
}
开发者ID:jiaming77,项目名称:DORIMANX_LG_STOCK_LP_KERNEL,代码行数:54,代码来源:do_mounts_dm.c


示例15: skip_code

static int skip_code(parser_ctx_t *ctx, BOOL exec_else)
{
    int if_depth = 1;
    const WCHAR *ptr;

    while(1) {
        ptr = strchrW(ctx->ptr, '@');
        if(!ptr) {
            WARN("No @end\n");
            return lex_error(ctx, JS_E_EXPECTED_CCEND);
        }
        ctx->ptr = ptr+1;

        if(!check_keyword(ctx, endW, NULL)) {
            if(--if_depth)
                continue;
            return 0;
        }

        if(exec_else && !check_keyword(ctx, elifW, NULL)) {
            if(if_depth > 1)
                continue;

            if(!skip_spaces(ctx) || *ctx->ptr != '(')
                return lex_error(ctx, JS_E_MISSING_LBRACKET);

            if(!parse_cc_expr(ctx))
                return -1;

            if(!get_ccbool(ctx->ccval))
                continue; /* skip block of code */

            /* continue parsing */
            ctx->cc_if_depth++;
            return 0;
        }

        if(exec_else && !check_keyword(ctx, elseW, NULL)) {
            if(if_depth > 1)
                continue;

            /* parse else block */
            ctx->cc_if_depth++;
            return 0;
        }

        if(!check_keyword(ctx, ifW, NULL)) {
            if_depth++;
            continue;
        }

        ctx->ptr++;
    }
}
开发者ID:oneminot,项目名称:reactos,代码行数:54,代码来源:lex.c


示例16: dm_setup_parse_device_args

static char * __init dm_setup_parse_device_args(char *str)
{
	char *next = NULL;
	size_t len = 0;

	/* Grab the logical name of the device to be exported to udev */
	len = get_dm_option(str, &next, DM_FIELD_SEP);
	if (!len) {
		DMERR("failed to parse device name");
		goto parse_fail;
	}
	len = min(len + 1, sizeof(dm_setup_args.name));
	strlcpy(dm_setup_args.name, str, len);  /* includes nul */
	str = skip_spaces(next);

	/* Grab the UUID value or "none" */
	len = get_dm_option(str, &next, DM_FIELD_SEP);
	if (!len) {
		DMERR("failed to parse device uuid");
		goto parse_fail;
	}
	len = min(len + 1, sizeof(dm_setup_args.uuid));
	strlcpy(dm_setup_args.uuid, str, len);
	str = skip_spaces(next);

	/* Determine if the table/device will be read only or read-write */
	if (!strncmp("ro,", str, 3)) {
		dm_setup_args.ro = 1;
	} else if (!strncmp("rw,", str, 3)) {
		dm_setup_args.ro = 0;
	} else {
		DMERR("failed to parse table mode");
		goto parse_fail;
	}
	str = skip_spaces(str + 3);

	return str;

parse_fail:
	return NULL;
}
开发者ID:jiaming77,项目名称:DORIMANX_LG_STOCK_LP_KERNEL,代码行数:41,代码来源:do_mounts_dm.c


示例17: parse_attr_value

bool parse_attr_value( const char * &str, char * buf )
{
    int pos = 0;
    skip_spaces( str );
    if (*str=='\"')
    {
        str++;
        for ( ; str[pos] && str[pos]!='\"'; pos++)
        {
            if (pos>=64)
                return false;
        }
        if (str[pos]!='\"')
            return false;
        for (int i=0; i<pos; i++)
            buf[i] = str[i];
        buf[pos] = 0;
        str += pos+1;
        skip_spaces( str );
        if (*str != ']')
            return false;
        str++;
        return true;
    }
    else
    {
        for ( ; str[pos] && str[pos]!=' ' && str[pos]!='\t' && str[pos]!=']'; pos++)
        {
            if (pos>=64)
                return false;
        }
        if (str[pos]!=']')
            return false;
        for (int i=0; i<pos; i++)
            buf[i] = str[i];
        buf[pos] = 0;
        str+=pos;
        str++;
        return true;
    }
}
开发者ID:buggins,项目名称:coolreader,代码行数:41,代码来源:lvstsheet.cpp


示例18: command_mtrigger

int command_mtrigger(char_data *actor, char *cmd, char *argument) {
  char_data *ch, *ch_next;
  trig_data *t;
  char buf[MAX_INPUT_LENGTH];

  /* prevent people we like from becoming trapped :P */
  if (!valid_dg_target(actor, 0))
    return 0;

  for (ch = world[IN_ROOM(actor)].people; ch; ch = ch_next) {
    ch_next = ch->next_in_room;

    if (SCRIPT_CHECK(ch, MTRIG_COMMAND) && !AFF_FLAGGED(ch, AFF_CHARM) &&
            ((actor != ch) || CONFIG_SCRIPT_PLAYERS)) {
      for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
        if (!TRIGGER_CHECK(t, MTRIG_COMMAND))
          continue;

        if (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t)) {
          mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: Command Trigger #%d has no text argument!",
                  GET_TRIG_VNUM(t));
          continue;
        }

        if (*GET_TRIG_ARG(t) == '*' ||
                !strn_cmp(GET_TRIG_ARG(t), cmd, strlen(GET_TRIG_ARG(t)))) {
          ADD_UID_VAR(buf, t, actor, "actor", 0);
          skip_spaces(&argument);
          add_var(&GET_TRIG_VARS(t), "arg", argument, 0);
          skip_spaces(&cmd);
          add_var(&GET_TRIG_VARS(t), "cmd", cmd, 0);

          if (script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW))
            return 1;
        }
      }
    }
  }

  return 0;
}
开发者ID:carriercomm,项目名称:LuminariMUD,代码行数:41,代码来源:dg_triggers.c


示例19: fs_cmd_mv

static int fs_cmd_mv(struct fs_info *session) {
	/* Usage: mv <from-name> <to-name> */
	int ret;
	char *tmp, *arg_fromname, *arg_toname;

	if (!session->is_connected) {
		fprintf(stderr, "Not connected.\n");
		return FTP_RET_FAIL;
	}

	/* Get args */
	tmp = &session->cmd_buff[0];
	skip_spaces(tmp); skip_word(tmp); skip_spaces(tmp);
	arg_fromname = tmp;
	skip_word(tmp); skip_spaces(tmp);
	arg_toname = tmp;

	split_word(arg_fromname);
	split_word(arg_toname);

	if ((*arg_fromname == '\0') || (*arg_toname == '\0')) {
		fprintf(stderr, "Please specify source and destonation names.\n");
		errno = EINVAL;
		return FTP_RET_ERROR;
	}
	/* --- END OF Get args --- */

	fprintf(stdout, "from: '%s`, to: '%s`\n", arg_fromname, arg_toname);

	ret = fs_execute(session, "RNFR %s\r\n", arg_fromname);
	if (ret != FTP_RET_OK) {
		return ret;
	}

	ret = fs_execute(session, "RNTO %s\r\n", arg_toname);
	if (ret != FTP_RET_OK) {
		return ret;
	}

	return FTP_RET_OK;
}
开发者ID:AleksandraButrova,项目名称:embox,代码行数:41,代码来源:ftp.c


示例20: mnt_parse_table_line

/*
 * Parses one line from {fs,m}tab
 */
static int mnt_parse_table_line(struct libmnt_fs *fs, char *s)
{
	int rc, n = 0;
	char *src, *fstype, *optstr;

	rc = sscanf(s,	UL_SCNsA" "	/* (1) source */
			UL_SCNsA" "	/* (2) target */
			UL_SCNsA" "	/* (3) FS type */
			UL_SCNsA" "	/* (4) options */
			"%n",		/* byte count */

			&src,
			&fs->target,
			&fstype,
			&optstr,
			&n);

	if (rc == 4) {
		unmangle_string(src);
		unmangle_string(fs->target);
		unmangle_string(fstype);
		unmangle_string(optstr);

		rc = __mnt_fs_set_source_ptr(fs, src);
		if (!rc)
			rc = __mnt_fs_set_fstype_ptr(fs, fstype);
		if (!rc)
			rc = mnt_fs_set_options(fs, optstr);
		free(optstr);
	} else {
		DBG(TAB, mnt_debug("tab parse error: [sscanf rc=%d]: '%s'", rc, s));
		rc = -EINVAL;
	}

	if (rc)
		return rc;	/* error */

	fs->passno = fs->freq = 0;
	s = skip_spaces(s + n);
	if (*s) {
		if (next_number(&s, &fs->freq) != 0) {
			if (*s) {
				DBG(TAB, mnt_debug("tab parse error: [freq]"));
				rc = -EINVAL;
			}
		} else if (next_number(&s, &fs->passno) != 0 && *s) {
			DBG(TAB, mnt_debug("tab parse error: [passno]"));
			rc = -EINVAL;
		}
	}

	return rc;
}
开发者ID:pexip,项目名称:os-util-linux,代码行数:56,代码来源:tab_parse.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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