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


C++ ISALPHA函数代码示例

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


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

示例1: cli_is_id

/*
 * -------------------------------------------------------
 * Check if string is an identifier
 * (consists of at least one alpha character followed by
 * alphanumerics or underline characters in any order)
 *
 * Return:
 *	TRUE	- identifier
 *	FALSE	- otherwise
 * -------------------------------------------------------
 */
int cli_is_id(char *p)
{
	if (!ISALPHA(*p))
		return (FALSE);

	while (*p && (ISALPHA(*p) || ISDIGIT(*p) || *p == '_' ))
		p++;

	if (*p) return (FALSE);
	else return (TRUE);
}
开发者ID:h4ck3rm1k3,项目名称:FIS-GT.M,代码行数:22,代码来源:cli_lex.c

示例2: insn_extract

static unsigned long
insn_extract (char param_ch, char *enc_initial)
{
  char *enc;
  unsigned long ret = 0;
  unsigned opc_pos = 32;

  for (enc = enc_initial; *enc != '\0'; )
    if ((*enc == '0') && (*(enc + 1) == 'x')) 
      {
	unsigned long tmp = strtol (enc+2, NULL, 16);

        opc_pos -= 4;
	if (param_ch == '0' || param_ch == '1')
	  {
	    if (param_ch == '0')
	      tmp = 15 - tmp;
	    ret |= tmp << opc_pos;
	  }
        enc += 3;
      }
    else
      {
	if (*enc == '0' || *enc == '1' || *enc == '-' || ISALPHA (*enc))
	  {
	    opc_pos--;
	    if (param_ch == *enc)
	      ret |= 1 << opc_pos;
	  }
	enc++;
      }
  return ret;
}
开发者ID:BGmot,项目名称:playbook-dev-tools,代码行数:33,代码来源:or32-opc.c

示例3: ipsc_matchstr

/*
 * 'string' compare for scanning
 */
int
ipsc_matchstr(sinfo_t *sp, char *str, int n)
{
	char *s, *t, *up;
	int i = n;

	if (i > sp->s_len)
		i = sp->s_len;
	up = str;

	for (s = sp->s_txt, t = sp->s_msk; i; i--, s++, t++, up++)
		switch ((int)*t)
		{
		case '.' :
			if (*s != *up)
				return 1;
			break;
		case '?' :
			if (!ISALPHA(*up) || ((*s & 0x5f) != (*up & 0x5f)))
				return 1;
			break;
		case '*' :
			break;
		}
	return 0;
}
开发者ID:VargMon,项目名称:netbsd-cvs-mirror,代码行数:29,代码来源:ip_scan.c

示例4: has_magic

/* Return nonzero if S has any special globbing chars in it.  */
static int
has_magic(const char *s, int flags)
{
    const int escape = !(flags & FNM_NOESCAPE);
    const int nocase = flags & FNM_CASEFOLD;

    register const char *p = s;
    register char c;

    while ((c = *p++) != 0) {
	switch (c) {
	  case '*':
	  case '?':
	  case '[':
	    return 1;

	  case '\\':
	    if (escape && !(c = *p++))
		return 0;
	    continue;

	  default:
	    if (!FNM_SYSCASE && ISALPHA(c) && nocase)
		return 1;
	}

	p = Next(p-1);
    }

    return 0;
}
开发者ID:tflynn,项目名称:ruby19-norubygems,代码行数:32,代码来源:dir.c

示例5: caps_effect

static char caps_effect(char c)
{
    if (ISALPHA(c) && ISLOWER(c))
        return TOUPPER(c);

    return c;
}
开发者ID:Asido,项目名称:OS,代码行数:7,代码来源:keyboard.c

示例6: cgen_keyword_lookup_name

const CGEN_KEYWORD_ENTRY *
cgen_keyword_lookup_name (CGEN_KEYWORD *kt, const char *name)
{
  const CGEN_KEYWORD_ENTRY *ke;
  const char *p,*n;

  if (kt->name_hash_table == NULL)
    build_keyword_hash_tables (kt);

  ke = kt->name_hash_table[hash_keyword_name (kt, name, 0)];

  /* We do case insensitive comparisons.
     If that ever becomes a problem, add an attribute that denotes
     "do case sensitive comparisons".  */

  while (ke != NULL)
    {
      n = name;
      p = ke->name;

      while (*p
	     && (*p == *n
		 || (ISALPHA (*p) && (TOLOWER (*p) == TOLOWER (*n)))))
	++n, ++p;

      if (!*p && !*n)
	return ke;

      ke = ke->next_name;
    }

  if (kt->null_entry)
    return kt->null_entry;
  return NULL;
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:35,代码来源:cgen-opc.c

示例7: cxx_scoped_identifier

/* Test if a string is a valid C++ identifier (possibly scope qualified).  */
int
cxx_scoped_identifier (const char *s)
{
    if (*s != ':')
        goto no_scope_prefix;

   while (1)
    {
        if (*++s != ':')
            return 0;
        ++s;

      no_scope_prefix:
        if (!ISALPHA ((unsigned char)*s) && *s != '_')
            return 0;

        while (*++s != ':')
        {
            if (*s == '\0')
                return 1;
            else if (!ISALNUM ((unsigned char)*s) && *s != '_')
                return 0;
        }
    }
}
开发者ID:mok0,项目名称:opag,代码行数:26,代码来源:util.c

示例8: main

int main(int argc, char const *argv[])
{
  int len, n, i;
  char word[MAXWORD];


  printf("%d\n", sizeof("abcd"));

  return 0;
  
  while((len = getword(word, MAXWORD)) >= 0)
  {
    if (ISALPHA(word[0]))
    {
      if ((n = binsearch(word, keytab, NKEYS)) > 0)
      {
        keytab[n].count++;
      }
    }
  }

  for (i = 0; i < NKEYS; ++i)
  {
    printf("%s: %d\n", keytab[i].word, keytab[i].count);
  }

  return 0;
}
开发者ID:yangmiemie,项目名称:books,代码行数:28,代码来源:word_tab.c

示例9: shift_effect

static char shift_effect(char c, short code)
{
    if (ISDIGIT(c) || ISSYMBOL(c))
        return SCAN_CODES_SYMBOLS[code];
    else if (ISALPHA(c) && ISLOWER(c))
        return TOUPPER(c);

    return c;
}
开发者ID:Asido,项目名称:OS,代码行数:9,代码来源:keyboard.c

示例10: yylex

yylex()
{
	register c;
	int i;

	if (pass == PASS_1) {
		/* scan the input file */
		do
			c = nextchar();
		while (isspace(c) && c != '\n');
		if (ISALPHA(c))
			c = inident(c);
		else if (isdigit(c))
			c = innumber(c);
		else switch (c) {
		case '=':
		case '<':
		case '>':
		case '|':
		case '&':
			c = induo(c); break;
		case ASC_SQUO:
		case ASC_DQUO:
			c = instring(c); break;
		case ASC_COMM:
			do
				c = nextchar();
			while (c != '\n' && c != '\0');
			break;
		case CTRL('A'):
			c = CODE1; readcode(1); break;
		case CTRL('B'):
			c = CODE2; readcode(2); break;
		case CTRL('C'):
			c = CODE4; readcode(4); break;
		}

		/* produce the intermediate token file */
		if (c <= 0)
			return(0);
		if (c <= 127)
			putc(c, tempfile);
		else
			putval(c);
	} else {
		/* read from intermediate token file */
		c = getc(tempfile);
		if (c == EOF)
			return(0);
		if (c > 127) {
			c += 128;
			c = getval(c);
		}
	}
	return(c);
}
开发者ID:h31nr1ch,项目名称:SOP,代码行数:56,代码来源:comm5.c

示例11: parsekeyword

static int parsekeyword(unsigned char **pattern, unsigned char *charset)
{
  parsekey_state state = CURLFNM_PKW_INIT;
#define KEYLEN 10
  char keyword[KEYLEN] = { 0 };
  int found = FALSE;
  int i;
  unsigned char *p = *pattern;
  for(i = 0; !found; i++) {
    char c = *p++;
    if(i >= KEYLEN)
      return SETCHARSET_FAIL;
    switch(state) {
    case CURLFNM_PKW_INIT:
      if(ISALPHA(c) && ISLOWER(c))
        keyword[i] = c;
      else if(c == ':')
        state = CURLFNM_PKW_DDOT;
      else
        return 0;
      break;
    case CURLFNM_PKW_DDOT:
      if(c == ']')
        found = TRUE;
      else
        return SETCHARSET_FAIL;
    }
  }
#undef KEYLEN

  *pattern = p; /* move caller's pattern pointer */
  if(strcmp(keyword, "digit") == 0)
    charset[CURLFNM_DIGIT] = 1;
  else if(strcmp(keyword, "alnum") == 0)
    charset[CURLFNM_ALNUM] = 1;
  else if(strcmp(keyword, "alpha") == 0)
    charset[CURLFNM_ALPHA] = 1;
  else if(strcmp(keyword, "xdigit") == 0)
    charset[CURLFNM_XDIGIT] = 1;
  else if(strcmp(keyword, "print") == 0)
    charset[CURLFNM_PRINT] = 1;
  else if(strcmp(keyword, "graph") == 0)
    charset[CURLFNM_GRAPH] = 1;
  else if(strcmp(keyword, "space") == 0)
    charset[CURLFNM_SPACE] = 1;
  else if(strcmp(keyword, "blank") == 0)
    charset[CURLFNM_BLANK] = 1;
  else if(strcmp(keyword, "upper") == 0)
    charset[CURLFNM_UPPER] = 1;
  else if(strcmp(keyword, "lower") == 0)
    charset[CURLFNM_LOWER] = 1;
  else
    return SETCHARSET_FAIL;
  return SETCHARSET_OK;
}
开发者ID:2px,项目名称:curl,代码行数:55,代码来源:curl_fnmatch.c

示例12: c_identifier

/* Test if a string is a valid C identifier.  */
int
c_identifier (const char *s)
{
    if (!ISALPHA ((unsigned char)*s) && *s != '_')
        return 0;

    while (*++s != '\0')
        if (!ISALNUM ((unsigned char)*s) && *s != '_')
            return 0;

    return 1;
}
开发者ID:mok0,项目名称:opag,代码行数:13,代码来源:util.c

示例13: _Py_bytes_isalpha

PyObject*
_Py_bytes_isalpha(const char *cptr, Py_ssize_t len)
{
    register const unsigned char *p
        = (unsigned char *) cptr;
    register const unsigned char *e;

    /* Shortcut for single character strings */
    if (len == 1 && ISALPHA(*p))
	Py_RETURN_TRUE;

    /* Special case for empty strings */
    if (len == 0)
	Py_RETURN_FALSE;

    e = p + len;
    for (; p < e; p++) {
	if (!ISALPHA(*p))
	    Py_RETURN_FALSE;
    }
    Py_RETURN_TRUE;
}
开发者ID:1310701102,项目名称:sl4a,代码行数:22,代码来源:bytes_methods.c

示例14: gfc_match_defined_op_name

match
gfc_match_defined_op_name (char *result, int error_flag)
{
  static const char * const badops[] = {
    "and", "or", "not", "eqv", "neqv", "eq", "ne", "ge", "le", "lt", "gt",
      NULL
  };

  char name[GFC_MAX_SYMBOL_LEN + 1];
  locus old_loc;
  match m;
  int i;

  old_loc = gfc_current_locus;

  m = gfc_match (" . %n .", name);
  if (m != MATCH_YES)
    return m;

  /* .true. and .false. have interpretations as constants.  Trying to
     use these as operators will fail at a later time.  */

  if (strcmp (name, "true") == 0 || strcmp (name, "false") == 0)
    {
      if (error_flag)
	goto error;
      gfc_current_locus = old_loc;
      return MATCH_NO;
    }

  for (i = 0; badops[i]; i++)
    if (strcmp (badops[i], name) == 0)
      goto error;

  for (i = 0; name[i]; i++)
    if (!ISALPHA (name[i]))
      {
	gfc_error ("Bad character %qc in OPERATOR name at %C", name[i]);
	return MATCH_ERROR;
      }

  strcpy (result, name);
  return MATCH_YES;

error:
  gfc_error ("The name %qs cannot be used as a defined operator at %C",
	     name);

  gfc_current_locus = old_loc;
  return MATCH_ERROR;
}
开发者ID:gcc-mirror,项目名称:gcc,代码行数:51,代码来源:matchexp.c

示例15: parse_id

char* parse_id(char **p)
{
	char* ret = (char*)malloc(32);
	int   len = 0;
	while( ISNUMERIC(**p) || ISALPHA(**p) || **p == '_' )
	{
		if( len < 30)
			ret[len++] = **p;
		(*p)++;
	} 
	if(**p == '%' || **p == '$')
		ret[len++] = *((*p)++);
	ret[len] = 0;
	return ret;	
}
开发者ID:38,项目名称:basiclone,代码行数:15,代码来源:expression.c


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