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


C++ skip_space函数代码示例

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


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

示例1: response_header_callback

static size_t response_header_callback(void *ptr, size_t size,
        size_t nmemb, void *userdata)
{
    upyun_http_header_t** headers = userdata;
    char ccc_buf[1024] = {0};
    memcpy(ccc_buf, ptr, size * nmemb);

    /* there wont be multilines, one line in each call. */
    char* line = ptr;
    char* line_end = line + size * nmemb;

    skip_space(&line, line_end);
    char* name = get_token(&line, ":", line_end);
    if(name == NULL) return size * nmemb;

    skip_space(&line, line_end);
    if(line == line_end) return size * nmemb;

    char* value = get_token(&line, "\r\n", line_end);
    if(value == NULL) return size * nmemb;

    upyun_http_header_t* h = calloc(1, sizeof(upyun_http_header_t));
    if(h == NULL) return size * nmemb;

    strncpy(h->name, name, UPYUN_MAX_HEADER_LEN);
    strncpy(h->value, value, UPYUN_MAX_HEADER_LEN);

    h->next = *headers;
    *headers = h;

    /* printf("New header:[%s]: [%s], %u, %u\n", h->name, h->value, size, */
    /*        nmemb); */
    return size * nmemb;
}
开发者ID:Valar-Morghulis,项目名称:cUPYun,代码行数:34,代码来源:upyun.c

示例2: read_pair

Cell read_pair(FILE *in) {
    int c;
    Cell car_obj;
    Cell cdr_obj;

    skip_space(in);
    c = getc(in);
    if (c == ')') {
        return null;
    }
    ungetc(c, in);
    car_obj = read(in);
    skip_space(in);
    c = getc(in);
    if (c == '.') {
        c = peek(in);
        if (!is_delimiter(c)) {
            fprintf(stderr, "dot not followed by delimiter\n");
            exit(1);
        }
        cdr_obj = read(in);
        skip_space(in);
        c = getc(in);
        if (c != ')') {
            fprintf(stderr, "missing right paren\n");
            exit(1);
        }
        return cons(car_obj, cdr_obj);
    }
    else { /* read list */
        ungetc(c, in);
        cdr_obj = read_pair(in);
        return cons(car_obj, cdr_obj);
    }
}
开发者ID:keleshev,项目名称:little-scheme,代码行数:35,代码来源:little.c

示例3: get_b_arg

char* get_b_arg(struct expr_node **expr,char *p,int line_count)
{
	struct expr_node *new_expr,*new_expr2,*new_expr3;
	char s1[MAXSTR];
	p=get_arg(&new_expr,p,line_count);
	p=skip_space(p);
	if((*p=='\n')||(*p==','))
	{
		*expr=new_expr;
		return p;
	}
	//if is_bool_op(p)
	if(is_bool_op(p,line_count))
	{
		new_expr2=(struct expr_node*)malloc(sizeof(struct expr_node));
		if(new_expr2==NULL)
		{ sprintf(s1,"at line %d, error malloc exr_node",line_count);die(s1);}
		new_expr2->type=OP_BOOL;
		p=get_token(p);
		strncpy(new_expr2->str,my_token,MAXSTR);
		new_expr2->left=new_expr;
		new_expr2->right=NULL;
		p=skip_space(p);
		p=get_arg(&new_expr3,p,line_count);
		new_expr2->right=new_expr3;
		*expr=new_expr2;
	}
	return p;
}
开发者ID:elboza,项目名称:WiCE,代码行数:29,代码来源:parse.c

示例4: tuple

tree
xml_html_parser::parse_doctype () {
  s += 9;
  tree dt= tuple ("doctype");
  skip_space ();
  dt << parse_name ();
  skip_space ();
  if (test (s, "SYSTEM")) dt << parse_system ();
  else if (test (s, "PUBLIC")) dt << parse_public ();
  skip_space ();

  if (test (s, "[")) {
    s += 1;
    while (s) {
      skip_space ();
      if (test (s, "]")) { s += 1; break; }
      else if (test (s, "<!ELEMENT")) dt << parse_element ();
      else if (test (s, "<!ATTLIST")) dt << parse_cdata ();
      else if (test (s, "<!ENTITY")) parse_entity_decl ();
      else if (test (s, "<!NOTATION")) a << parse_notation ();
      else if (test (s, "<?")) dt << parse_pi ();
      else if (test (s, "<!--")) dt << parse_comment ();
      else if (s[0] == '&' || s[0] == '%') (void) parse_entity ();
      else s += 1;
    }
  }

  skip_space ();
  if (test (s, ">")) s += 1;
  return dt;
}
开发者ID:KarlHegbloom,项目名称:texmacs,代码行数:31,代码来源:parsexml.cpp

示例5: map_cmd

static void map_cmd(const char **s)
{
  if ( **s == '*' )
  {
    range_from = 32;
    range_to = 255;
    map_to = 32;
    is_exclude = 0;
    
    (*s)++;
    skip_space(s);
  }
  else if ( **s == '~' )
  {
    is_exclude = 1;
    map_to = 0;	/*will be ignored */
    
    (*s)++;
    skip_space(s);
    get_range(s);
    
  }
  else 
  {
    is_exclude = 0;
    get_range(s);
    map_to = range_from;
    if ( **s == '>')
    {
      (*s)++;
      skip_space(s);
      map_to = get_add(s);
    }
  }
}
开发者ID:AbuShaqra,项目名称:ucglib,代码行数:35,代码来源:bdf_map.c

示例6: ft_atoi

int				ft_atoi(const char *str)
{
	int		i;
	int		mult;
	int		ret;

	if (!str)
		return (0);
	else if (skip_space(str) < 0)
		return (0);
	i = skip_space(str);
	ret = 0;
	mult = 1;
	while (str[i] && is_char(str[i]) == 0 && i >= 0)
	{
		ret += ((str[i] - 48) * mult);
		mult *= 10;
		i--;
	}
	if (is_char(str[i]) >= 1 && is_char(str[i - 1]) == 1)
		return (0);
	else if (str[i] == '-' && ret > 0)
		ret *= -1;
	else if (str[i] == '\200')
		return (0);
	return (ret);
}
开发者ID:Draeyo,项目名称:FdF,代码行数:27,代码来源:ft_atoi.c

示例7: set_acceptance

int	set_acceptance(
	char *line
	)
{
unsigned char *lptr;
unsigned char *endptr;			/* unsigned char **endptr; */
unsigned int acm = 0xffffffff;
unsigned int acc = 0xffffffff;
Config_par_t  cfg;
volatile Command_par_t cmd;

    lptr = &line[0];

    skip_space(lptr);
    acc  = strtoul(lptr, &endptr, 0);

    lptr = endptr;
    skip_space(lptr);
    acm  = strtoul(lptr, &endptr, 0);

    cmd.cmd = CMD_STOP;
    ioctl(can_fd, COMMAND, &cmd);
    /* high acceptance, low mask for 11 bit ID */
    cfg.target = CONF_ACC; 
    cfg.val1    = acm;
    cfg.val2    = acc;
    /* fprintf(stderr,"ACM=%04x\n", acm); */
    ioctl(can_fd, CONFIG, &cfg);

    cmd.cmd = CMD_START;
    ioctl(can_fd, COMMAND, &cmd);
}
开发者ID:OPSF,项目名称:uClinux,代码行数:32,代码来源:linux.c

示例8: add_definition

/*...sadd_definition:0:*/
static void add_definition(const char *line)
	{
	LOOKUP *lookup;

	if ( (lookup = (LOOKUP *) malloc(sizeof(LOOKUP))) == NULL )
		fatal("out of memory");

	line = skip_space(line);
	if ( strncmp(line, "language_create", 15) || !isspace(line[15]) )
		return; /* Is not a language definition line */

	line = skip_space(line + 16);
	if ( (line = scan_quoted_str(line, lookup->name)) == NULL )
		fatal("bad language name in initalisation file");

	line = skip_space(line);
	if ( (line = scan_quoted_str(line, lookup->rc_st)) == NULL )
		fatal("bad reserved Cmt.Start in initalisation file");

	line = skip_space(line);
	if ( (line = scan_quoted_str(line, lookup->rc_end)) == NULL )
		fatal("bad reserved Cmt.End in initalisation file");

	line = skip_space(line);
	if ( (line = scan_quoted_str(line, lookup->reg_exp)) == NULL )
		fatal("bad regular expression in initalisation file");

	lookups[n_lookups++] = lookup;
	}
开发者ID:OS2World,项目名称:APP-EDITOR-Flatten,代码行数:30,代码来源:flatten.c

示例9: Exception

	Variant JSONReader::parse_array()
	{
		if (!skip_char('['))
			throw Exception(position(), "expected start of array");

		Variant::Vector vector;

		skip_space();

		while (!skip_char(']'))
		{
			vector.emplace_back(parse_value());

			skip_space();

			if (skip_char(','))
			{
				skip_space();
				if (at(']'))
					throw Exception(position(), "expected value instead of ] after ,");
			}
			else if (!at(']'))
			{
				throw Exception(position(), "expected , or ]");
			}
		}

		return Variant(std::move(vector));
	}
开发者ID:martin-ejdestig,项目名称:rayni-staging,代码行数:29,代码来源:json_reader.cpp

示例10: parser_SetTextColor

static int parser_SetTextColor( char *psz_command, char *psz_end,
                                commandparams_t *p_params )
{
    int r = 0, g = 0, b = 0;
    VLC_UNUSED(psz_end);

    skip_space( &psz_command );
    if( isdigit( (unsigned char)*psz_command ) )
    {
        if( parse_digit( &psz_command, &p_params->i_id ) == VLC_EGENERIC )
            return VLC_EGENERIC;
    }
    skip_space( &psz_command );
    if( isdigit( (unsigned char)*psz_command ) )
    {
        if( parse_digit( &psz_command, &r ) == VLC_EGENERIC )
            return VLC_EGENERIC;
    }
    skip_space( &psz_command );
    if( isdigit( (unsigned char)*psz_command ) )
    {
        if( parse_digit( &psz_command, &g ) == VLC_EGENERIC )
            return VLC_EGENERIC;
    }
    skip_space( &psz_command );
    if( isdigit( (unsigned char)*psz_command ) )
    {
        if( parse_digit( &psz_command, &b ) == VLC_EGENERIC )
            return VLC_EGENERIC;
    }
    p_params->fontstyle.i_font_color = (r<<16) | (g<<8) | (b<<0);
    return VLC_SUCCESS;
}
开发者ID:RodrigoNieves,项目名称:vlc,代码行数:33,代码来源:dynamicoverlay_commands.c

示例11: write_message

int write_message(
	int format,	/* if true - extended message format */ 
	char *line	/* write parameter line */
	)
{
unsigned char data[8] = {8, 7, 6, 5, 4, 3 , 2, 1};
unsigned char *lptr;
int len = 0;
/* unsigned char **endptr; */
unsigned char *endptr;
canmsg_t tx;			/* build transmit message */



    /* May be some check is needed if we have a valid and useful message */

    lptr = &line[0];
    skip_space(lptr);

    tx.flags = 0;
    if(format == 1) {
	tx.flags |= MSG_EXT;
    } else {
    }
    if(*lptr == 'r' || *lptr == 'R') {
	tx.flags |= MSG_RTR;
	skip_word(lptr);
    }
    skip_space(lptr);
    tx.id  = strtoul(lptr, &endptr, 0);
    tx.cob = 0;

    while( lptr != endptr) {
        lptr = endptr;
        tx.data[len] = (signed char)strtol(lptr, &endptr, 0);
	if(lptr != endptr) len++;
	if (len == 8 ) break; 
    }

    tx.length = len;

BDEBUG("Transmit %d, RTR=%s, len=%d\n", tx.id,
			((tx.flags == 0) ? "F" : "T"),
			tx.length);
			
    len = write(can_fd, &tx, 1);

    if (len < 0) {
    	/* Write Error */
printf("Write Error: %d\n", len);
    }
    
    if (len == 0) {
    	/* Transmit Timeout */
printf("Write Error: Transmit fehlgeschlagen\n", len);
    }

    return 0;
}	
开发者ID:OPSF,项目名称:uClinux,代码行数:59,代码来源:linux.c

示例12: parse_line

static void parse_line(char *ptr, char **varname, char **varval)
{
  /* Skip over any leading spaces */

  ptr = skip_space(ptr);

  /* The first no-space is the beginning of the variable name */

  *varname = skip_space(ptr);
  *varval = NULL;

  /* Parse to the end of the variable name */

  ptr = find_name_end(ptr);

  /* An equal sign is expected next, perhaps after some white space */

  if (*ptr && *ptr != '=')
    {
      /* Some else follows the variable name.  Terminate the variable
       * name and skip over any spaces.
       */

      *ptr = '\0';
       ptr = skip_space(ptr + 1);
    }

  /* Verify that the equal sign is present */

  if (*ptr == '=')
    {
      /* Make sure that the variable name is terminated (this was already
       * done if the name was followed by white space.
       */

      *ptr = '\0';

      /* The variable value should follow =, perhaps separated by some
       * white space.
       */

      ptr = skip_space(ptr + 1);
      if (*ptr)
        {
          /* Yes.. a variable follows.  Save the pointer to the start
           * of the variable string.
           */

          *varval = ptr;

          /* Find the end of the variable string and make sure that it
           * is terminated.
           */

          ptr = find_value_end(ptr);
          *ptr = '\0';
        }
    }
}
开发者ID:cloudyourcar,项目名称:nuttx,代码行数:59,代码来源:cfgdefine.c

示例13: parse_pair

static bool
parse_pair(const char buffer[], char key[], char value[])
{
	const char *start;
	const char *end;

	key[0] = value[0] = '\0';

	/*
	 * parse key
	 */
	start = buffer;
	if ((start = skip_space(start, buffer)) == NULL)
		return false;

	end = start + strcspn(start, "=# \n\r\t\v");

	/* skip blank buffer */
	if (end - start <= 0)
	{
		if (*start == '=')
			elog(WARNING, "syntax error in \"%s\"", buffer);
		return false;
	}

	/* key found */
	strncpy(key, start, end - start);
	key[end - start] = '\0';

	/* find key and value split char */
	if ((start = skip_space(end, buffer)) == NULL)
		return false;

	if (*start != '=')
	{
		elog(WARNING, "syntax error in \"%s\"", buffer);
		return false;
	}

	start++;

	/*
	 * parse value
	 */
	if ((end = get_next_token(start, value, buffer)) == NULL)
		return false;

	if ((start = skip_space(end, buffer)) == NULL)
		return false;

	if (*start != '\0' && *start != '#')
	{
		elog(WARNING, "syntax error in \"%s\"", buffer);
		return false;
	}

	return true;
}
开发者ID:bwtakacy,项目名称:pg_reorg,代码行数:58,代码来源:pgut-fe.c

示例14: read_tag

static enum STATE read_tag ( FILE* file, struct xml_element* elem ) {

	int c = fgetc( file );
	if ( c != '<' ) return PARSE_ERROR;

	c = fgetc( file );
	if ( c == EOF ) return PARSE_ERROR;

	if( c == '?' || c == '!' )
		return read_special_tag( file, elem );

	bool close_tag = false;
	if ( c == '/' )
		close_tag = true;
	else
		ungetc( c, file );

	skip_space( file );

	struct string str = init_str;
	c = fgetc( file );

	if ( c == '>' )
		return PARSE_ERROR;

	while ( c != '>' && c != '/' && !isspace(c) ) {

		if ( c == EOF || str_push_back( c, &str ) != OK ) {
			free( str.str );
			return ( c == EOF ) ? PARSE_ERROR : MEMORY_ERROR;
		}
		c = fgetc( file );
	}

	if ( close_tag ) {

		if ( c == '/' || strcmp( str.str, elem->father->name ) != 0 ) {
			free( str.str );
			return PARSE_ERROR;
		}

		if ( c != '>') {
			skip_space( file );
			if ( fgetc( file ) != '>' ) {
				free( str.str );
				return PARSE_ERROR;
			}
		}
		free( str.str );
		return CLOSE_TAG;
	}

	str_remove_trail_space( &str );
	elem->name = str.str;
	ungetc( c, file );

	return read_attr( file, elem );
}
开发者ID:esneider,项目名称:xml,代码行数:58,代码来源:xml.c

示例15: parse_string

string
xml_html_parser::transcode (string s2) {
  s= parse_string (s2);

  string encoding;
  if (test (s, "<?")) {
    s += 2;
    string target= parse_name ();
    skip_space ();
    if (target == "xml") {
      // since html==true implies we can accept horribly broken HTML, the
      // presence of an XML prolog is not enough to clear the flag.
      /* html= false; */
      while (s && !test (s, "?>")) {
	string attname= parse_name ();
	skip_space ();
	if (!test (s, "=")) break;
	s += 1;
	skip_space ();
	string val;
	if (test (s, "\"")) {
	  s += 1;
	  val= parse_until ("\"");
	  skip_space ();	  
	}
	else if (test (s, "'")) {
	  s += 1;
	  val= parse_until ("'");
	  skip_space ();
	}
	if (attname == "encoding") {
	  encoding= upcase_all (val);
	  break;
	}
      }
    }
  }

  if (N(encoding) != 0) {
    // cout << "encoding was specified\n" ;
    string s3= convert (s2, encoding, "UTF-8");
    if (N(s3) == 0)
      /* conversion from specified charset failed, do nothing (and pray) */ ;
    else return s3;
  }
  else {
    // cout << "guess encoding\n" ;
    if (check_encoding (s2, "UTF-8"))
      /* input encoding seems to be utf-8, do nothing */ ;
    else {
      string s3= convert (s2, "ISO-8859-1", "UTF-8");
      if (N(s3) != 0) return s3;
    }
  }

  return s2;
}
开发者ID:KarlHegbloom,项目名称:texmacs,代码行数:57,代码来源:parsexml.cpp


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