本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例5: caps_effect
static char caps_effect(char c)
{
if (ISALPHA(c) && ISLOWER(c))
return TOUPPER(c);
return 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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}