本文整理汇总了C++中IS_SPACE函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_SPACE函数的具体用法?C++ IS_SPACE怎么用?C++ IS_SPACE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_SPACE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: set_param_option
int
set_param_option(char *option)
{
Str tmp = Strnew();
char *p = option, *q;
while (*p && !IS_SPACE(*p) && *p != '=')
Strcat_char(tmp, *p++);
while (*p && IS_SPACE(*p))
p++;
if (*p == '=') {
p++;
while (*p && IS_SPACE(*p))
p++;
}
Strlower(tmp);
if (set_param(tmp->ptr, p))
goto option_assigned;
q = tmp->ptr;
if (!strncmp(q, "no", 2)) { /* -o noxxx, -o no-xxx, -o no_xxx */
q += 2;
if (*q == '-' || *q == '_')
q++;
}
else if (tmp->ptr[0] == '-') /* -o -xxx */
q++;
else
return 0;
if (set_param(q, "0"))
goto option_assigned;
return 0;
option_assigned:
return 1;
}
开发者ID:galexcode,项目名称:w3m,代码行数:34,代码来源:rc.c
示例2: interpret_rc
static void
interpret_rc(FILE * f)
{
Str line;
Str tmp;
char *p;
for (;;) {
line = Strfgets(f);
Strchop(line);
if (line->length == 0)
break;
Strremovefirstspaces(line);
if (line->ptr[0] == '#') /* comment */
continue;
tmp = Strnew();
p = line->ptr;
while (*p && !IS_SPACE(*p))
Strcat_char(tmp, *p++);
while (*p && IS_SPACE(*p))
p++;
Strlower(tmp);
set_param(tmp->ptr, p);
}
}
开发者ID:galexcode,项目名称:w3m,代码行数:25,代码来源:rc.c
示例3: while
char *KLineFile::readLine() {
if (hot == NULL) {
return NULL;
}
while (*hot && IS_SPACE(*hot))
hot++;
if (*hot == '\0') {
return NULL;
}
char *p = hot;
char *end = strchr(hot, '\n');
if (end == NULL) {
if (strlen(hot) < 1) {
return NULL;
}
end = hot + strlen(hot) - 1;
hot = NULL;
}
hot = end + 1;
while (end != p && IS_SPACE(*end)) {
*end = '\0';
end--;
}
return p;
}
开发者ID:andrew-morris,项目名称:kangle,代码行数:25,代码来源:KLineFile.cpp
示例4: get_file_name_len
static int get_file_name_len(const char *str)
{
int len;
const char *save;
save = str;
while (IS_SPACE(*str))
++str;
if (!(*str) || (IS_DELIM(*str)))
return (return_error(MISS_NAME_DIR, END_CHAR));
while ((*str) && !(IS_SPACE(*str)) && !(IS_DELIM(*str)))
{
if (IS_QUOTE(*str))
{
if ((len = pass_quote(str)) == -1)
return (return_error(UNMATCH_QUOTE, *str));
str += len;
}
else if (*str == B_SLASH)
{
if (!(*(++str)))
return (return_error(MISS_SLASH, END_CHAR));
}
++str;
}
return (str - save);
}
开发者ID:rotarui,项目名称:42sh,代码行数:27,代码来源:cut_delim.c
示例5: add_rule
static int add_rule(rt_data_t *rdata, char *grplst, str *prefix, rt_info_t *rule)
{
long int t;
char *tmp;
char *ep;
int n;
tmp=grplst;
n=0;
/* parse the grplst */
while(tmp && (*tmp!=0)) {
errno = 0;
t = strtol(tmp, &ep, 10);
if (ep == tmp) {
LM_ERR("bad grp id '%c' (%d)[%s]\n",
*ep, (int)(ep-grplst), grplst);
goto error;
}
if ((!IS_SPACE(*ep)) && (*ep != SEP) && (*ep != SEP1) && (*ep!=0)) {
LM_ERR("bad char %c (%d) [%s]\n",
*ep, (int)(ep-grplst), grplst);
goto error;
}
if (errno == ERANGE && (t== LONG_MAX || t== LONG_MIN)) {
LM_ERR("out of bounds\n");
goto error;
}
n++;
/* add rule -> has prefix? */
if (prefix->len) {
/* add the routing rule */
if ( add_prefix(rdata->pt, prefix, rule, (unsigned int)t)!=0 ) {
LM_ERR("failed to add prefix route\n");
goto error;
}
} else {
if ( add_rt_info( &rdata->noprefix, rule, (unsigned int)t)!=0 ) {
LM_ERR("failed to add prefixless route\n");
goto error;
}
}
/* keep parsing */
if(IS_SPACE(*ep))
EAT_SPACE(ep);
if(ep && (*ep == SEP || *ep == SEP1))
ep++;
tmp = ep;
}
if(n==0) {
LM_ERR("no id in grp list [%s]\n",
grplst);
goto error;
}
return 0;
error:
return -1;
}
开发者ID:SipSeb,项目名称:kamailio,代码行数:59,代码来源:dr_load.c
示例6: VAL_LEN_HEAD
//
// Temp_Byte_Chars_May_Fail: C
//
// NOTE: This function returns a temporary result, and uses an internal
// buffer. Do not use it recursively. Also, it will Trap on errors.
//
// Prequalifies a string before using it with a function that
// expects it to be 8-bits. It would be used for instance to convert
// a string that is potentially REBUNI-wide into a form that can be used
// with a Scan_XXX routine, that is expecting ASCII or UTF-8 source.
// (Many TO-XXX conversions from STRING re-use that scanner logic.)
//
// Returns a temporary string and sets the length field.
//
// If `allow_utf8`, the constructed result is converted to UTF8.
//
// Checks or converts it:
//
// 1. it is byte string (not unicode)
// 2. if unicode, copy and return as temp byte string
// 3. it's actual content (less space, newlines) <= max len
// 4. it does not contain other values ("123 456")
// 5. it's not empty or only whitespace
//
REBYTE *Temp_Byte_Chars_May_Fail(
const REBVAL *val,
REBINT max_len,
REBCNT *length,
REBOOL allow_utf8
) {
REBCNT tail = VAL_LEN_HEAD(val);
REBCNT index = VAL_INDEX(val);
REBCNT len;
REBUNI c;
REBYTE *bp;
REBSER *src = VAL_SERIES(val);
if (index > tail) fail (Error(RE_PAST_END));
Resize_Series(BYTE_BUF, max_len+1);
bp = BIN_HEAD(BYTE_BUF);
// Skip leading whitespace:
for (; index < tail; index++) {
c = GET_ANY_CHAR(src, index);
if (!IS_SPACE(c)) break;
}
// Copy chars that are valid:
for (; index < tail; index++) {
c = GET_ANY_CHAR(src, index);
if (c >= 0x80) {
if (!allow_utf8) fail (Error(RE_INVALID_CHARS));
len = Encode_UTF8_Char(bp, c);
max_len -= len;
bp += len;
}
else if (!IS_SPACE(c)) {
*bp++ = (REBYTE)c;
max_len--;
}
else break;
if (max_len < 0)
fail (Error(RE_TOO_LONG));
}
// Rest better be just spaces:
for (; index < tail; index++) {
c = GET_ANY_CHAR(src, index);
if (!IS_SPACE(c)) fail (Error(RE_INVALID_CHARS));
}
*bp = '\0';
len = bp - BIN_HEAD(BYTE_BUF);
if (len == 0) fail (Error(RE_TOO_SHORT));
if (length) *length = len;
return BIN_HEAD(BYTE_BUF);
}
开发者ID:rhencke,项目名称:rebol,代码行数:82,代码来源:s-ops.c
示例7: JamGetProp
/*
* JamGetProp
*
* Parse a text buffer of property name-value pairs and return
* the value of the property identified by <propName>. <buffer>
* is a NUL-terminated string containing text in the following format:
*
* "Prop-Name1: prop value 1\nProp-Name2: prop value 2..."
*
* Return-value:
*
* A pointer into the buffer of the first non-space character of
* the property value. <*length> returns the length of the property
* value, excluding any trailing white-space characters.
*
* If the given property is not found in <buffer>, NULL is returned.
*/
char* JamGetProp(char* buffer, char* name, int* length) {
char* p;
char* retval;
int len;
for (p=buffer;*p;) {
if (strncmp(p, name, strlen(name)) != 0) {
while (*p) {
if (*p == '\n') {
++p;
break;
}
++ p;
}
continue;
}
p += strlen(name);
while (*p && *p != '\n' && IS_SPACE(*p)) {
p++;
}
if (*p == ':') {
p++;
}
while (*p && *p != '\n' && IS_SPACE(*p)) {
p++;
}
retval = p;
while (*p && *p != '\n') {
p++;
}
while (p > retval && IS_SPACE(*p)) {
p--;
}
len = (p - retval + 1);
if (length == NULL) { /* DUP the string */
char * newStr;
if ((newStr = browser_malloc(len + 1)) == NULL) {
return NULL;
}
strnzcpy(newStr, retval, len);
newStr[len] = 0;
for (p=newStr; *p; p++) {
if (*p == '\r') {
*p = '\0';
}
}
return newStr;
} else {
*length = len;
return retval;
}
}
return NULL;
}
开发者ID:zyb2013,项目名称:kvm-src,代码行数:72,代码来源:jamParse.c
示例8: output
/* change content of object, actually not send it */
MODULE_STATIC
int
output(int so, struct output_object *obj, struct request *rq, int *flags)
{
char *content_type, *agent = NULL, *p, *charset_name, *new_conttype;
struct charset *cs = NULL;
struct av *ct_av = NULL;
if ( !rq || !obj || !obj->body || !obj->headers )
return(MOD_CODE_OK);
ct_av = lookup_av_by_attr(obj->headers, "Content-Type");
if ( !ct_av )
return(MOD_CODE_OK);
content_type = ct_av->val;
if ( !content_type )
return(MOD_CODE_OK);
p = content_type;
while( *p && IS_SPACE(*p) ) p++;
if ( strncasecmp(p, "text/html", 9) && strncasecmp(p, "text/plain", 10) )
return(MOD_CODE_OK);
/* parse parameters and return if charset is already here */
while ( (p = strchr(p, ';')) ) {
p++;
while( *p && IS_SPACE(*p) ) p++;
if ( !strncasecmp(p, "charset=", 8) )
return(MOD_CODE_OK);
}
if ( rq->av_pairs ) agent = attr_value(rq->av_pairs, "User-Agent");
if ( !agent )
return(MOD_CODE_OK);
RDLOCK_LANG_CONFIG ;
if ( agent && charsets )
cs = lookup_charset_by_Agent(charsets, agent);
if ( cs ) charset_name = cs->Name;
else charset_name = default_charset;
if ( !charset_name || !*charset_name ) {
UNLOCK_LANG_CONFIG ;
return(MOD_CODE_OK);
}
/* set up charset */
new_conttype = malloc(10+strlen(content_type)+strlen(charset_name)+1);
if ( new_conttype ) {
sprintf(new_conttype,"%s; charset=%s", content_type, charset_name);
xfree(ct_av->val);
ct_av->val = new_conttype;
if ( cs ) {
recode_buff(obj->body, cs);
}
}
UNLOCK_LANG_CONFIG ;
return(MOD_CODE_OK);
}
开发者ID:stiletto,项目名称:oops,代码行数:56,代码来源:lang.c
示例9: add_header_av
inline static int add_header_av(char* avtext, struct mem_obj *obj)
{
struct av *new_t = NULL, *next;
char *attr = avtext, *sp = avtext, *val, holder;
char *new_attr = NULL, *new_val = NULL;
char nullstr[1];
if ( *sp == 0 ) return(-1);
while( *sp && IS_SPACE(*sp) ) sp++;
while( *sp && !IS_SPACE(*sp) && (*sp != ':') ) sp++;
if ( !*sp ) {
my_xlog(OOPS_LOG_NOTICE|OOPS_LOG_DBG|OOPS_LOG_INFORM, "add_header_av(): Invalid header string: '%s'\n", avtext);
nullstr[0] = 0;
sp = nullstr;
}
if ( *sp == ':' ) sp++;
holder = *sp;
*sp = 0;
if ( !strlen(attr) ) return(-1);
new_t = (struct av *)xmalloc(sizeof(*new_t), "add_header_av(): for av pair");
if ( !new_t ) goto failed;
new_attr = (char *)xmalloc( strlen(attr)+1, "add_header_av(): for new_attr" );
if ( !new_attr ) goto failed;
strcpy(new_attr, attr);
*sp = holder;
val = sp;
while( *val && IS_SPACE(*val) ) val++;
/*if ( !*val ) goto failed;*/
new_val = (char *)xmalloc( strlen(val) + 1, "add_header_av(): for new_val");
if ( !new_val ) goto failed;
strcpy(new_val, val);
new_t->attr = new_attr;
new_t->val = new_val;
new_t->next = NULL;
if ( !obj->headers ) {
obj->headers = new_t;
} else {
next = obj->headers;
while (next->next) next=next->next;
next->next=new_t;
}
return(0);
failed:
*sp = holder;
if ( new_t ) free(new_t);
if ( new_attr ) free(new_attr);
if ( new_val ) free(new_val);
return(-1);
}
开发者ID:zhushengwen,项目名称:example-zhushengwen,代码行数:50,代码来源:http_utils.cpp
示例10: trim
void trim(const char *str, char *buf) {
strcpy(buf, str);
char *tail, *head;
for (tail = buf + strlen(buf) - 1; tail >= buf; tail--) {
if (!IS_SPACE(*tail))
break;
}
tail[1] = 0;
for (head = buf; head <= tail; head++) {
if (!IS_SPACE(*head))
break;
}
if (head != buf)
memcpy(buf, head, (tail - head + 2) * sizeof(char));
}
开发者ID:yafengli,项目名称:koala,代码行数:15,代码来源:yf_trim.c
示例11: SKIP_SPACE
static char *xml_meta_attr_value(ACL_XML3_ATTR *attr, char *data)
{
ACL_XML3 *xml = attr->node->xml;
int ch;
SKIP_SPACE(data);
if (IS_QUOTE(*data))
attr->quote = *data++;
if (*data == 0)
return data;
if (attr->value == xml->addr)
attr->value = data;
while ((ch = *data) != 0) {
if (attr->quote && ch == attr->quote) {
attr->value_size = data - attr->value;
*data++ = 0;
break;
} else if (IS_SPACE(ch)) {
attr->value_size = data - attr->value;
*data++ = 0;
break;
}
data++;
}
return data;
}
开发者ID:DayBreakZhang,项目名称:acl,代码行数:31,代码来源:acl_xml3_parse.c
示例12: assert
/** 先頭パラメータの発見
@param[in] end buf末尾
@param[in] p 解析の現在位置
パラメータが0個と1個以上の判別のために状態を設けている.
*/
const wchar_t* COutlineErlang::ScanArgs1( const wchar_t* end, const wchar_t* p )
{
assert( m_state == STATE_FUNC_ARGS1 );
while( IS_SPACE( *p ) && p < end )
p++;
if( p >= end )
return end;
if( *p == /* ( */ L')' ){
// no argument
m_state = STATE_FUNC_ARGS_FIN;
p++;
}
else if( IS_COMMENT( *p )){
return end;
}
else {
// argument found
m_state = STATE_FUNC_ARGS;
++m_argcount;
}
return p;
}
开发者ID:beru,项目名称:sakura,代码行数:32,代码来源:CType_Erlang.cpp
示例13: epd_pv_plies
static int /* 0 | ply depth of pv ending with '#' */
epd_pv_plies( EpdJob* ejp )
{
register char* p;
register char* q;
int plies;
plies = 0;
q = 0;
p = epd_find_op_opnds(ejp, "pv");
if( p ) {
SKIP_SPACE(p);
while( *p ) {
plies += 1;
while( *p && !IS_SPACE(*p) ) {
q = p; ++p;
}
SKIP_SPACE(p);
}
if( !q || (q[0] != '#') ) { /* no mate indicator at end ... */
plies = 0; /* ... so we know nothing */
}
}
return plies;
}
开发者ID:redo007,项目名称:chess_with_chest,代码行数:25,代码来源:epdio.c
示例14: cleanGeoms
void dxSAPSpace::cleanGeoms()
{
int dirtySize = DirtyList.size();
if( !dirtySize )
return;
// compute the AABBs of all dirty geoms, clear the dirty flags,
// remove from dirty list, place into geom list
lock_count++;
int geomSize = GeomList.size();
GeomList.setSize( geomSize + dirtySize ); // ensure space in geom list
for( int i = 0; i < dirtySize; ++i ) {
dxGeom* g = DirtyList[i];
if( IS_SPACE(g) ) {
((dxSpace*)g)->cleanGeoms();
}
g->recomputeAABB();
g->gflags &= (~(GEOM_DIRTY|GEOM_AABB_BAD));
// remove from dirty list, add to geom list
GEOM_SET_DIRTY_IDX( g, GEOM_INVALID_IDX );
GEOM_SET_GEOM_IDX( g, geomSize + i );
GeomList[geomSize+i] = g;
}
// clear dirty list
DirtyList.setSize( 0 );
lock_count--;
}
开发者ID:BackupTheBerlios,项目名称:dingus-svn,代码行数:30,代码来源:collision_sapspace.cpp
示例15: MimeUntypedText_uu_end_line_p
static bool MimeUntypedText_uu_end_line_p(const char *line, int32_t length) {
#if 0
/* A strictly conforming uuencode end line. */
return (line[0] == 'e' &&
line[1] == 'n' &&
line[2] == 'd' &&
(line[3] == 0 || IS_SPACE(line[3])));
#else
/* ...but, why don't we accept any line that begins with the three
letters "END" in any case: I've seen lots of partial messages
that look like
BEGIN----- Cut Here-----
begin 644 foo.gif
Mxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Mxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Mxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
END------- Cut Here-----
so let's be lenient here. (This is only for the untyped-text-plain
case -- the uudecode parser itself is strict.)
*/
return (line[0] == ' ' || line[0] == '\t' ||
((line[0] == 'e' || line[0] == 'E') &&
(line[1] == 'n' || line[1] == 'N') &&
(line[2] == 'd' || line[2] == 'D')));
#endif
}
开发者ID:mozilla,项目名称:releases-comm-central,代码行数:28,代码来源:mimeunty.cpp
示例16: gettag
int gettag(FILE* html,char* tag)
{
int c=0;
char* p=tag;
int lim=MAX_TAG-2;
do {
c=NEXT_CHAR(html);
if (c==EOF) break;
} while (c!='<');
if (c==EOF) goto END_OF_FILE;
SKIP_WS(html,c);
do {
if (lim--<0) break;
*tag++=c;
c=NEXT_CHAR(html);
} while (!IS_SPACE(c));
*tag='\0';
return 1;
END_OF_FILE:
*tag='\0';
return 0;
}
开发者ID:badcodes,项目名称:c,代码行数:28,代码来源:parser.c
示例17: getproperty
int getproperty(FILE* html,char* property)
{
int c=0;
char* p=property;
int outword=0;
int lim=MAX_PROPERTY-2;
SKIP_WS(html,c);
do {
if (IS_SPACE(c)) {outword=1;SKIP_WS(html,c);}
if (c==EOF) goto END_OF_FILE;
if (c=='=') break;
if (outword) {property=p;outword=0;}
*property++=c;
if (lim--<0) break;
c=NEXT_CHAR(html);
if (c==EOF) goto END_OF_FILE;
} while (c!='=');
*property='\0';
return 1;
END_OF_FILE:
*property='\0';
return 0;
}
开发者ID:badcodes,项目名称:c,代码行数:26,代码来源:parser.c
示例18: numeric_arg
/*--------------------------------------------------------------------------.
| The function numeric_arg () converts ARG to an int pointed to by VALUEP. |
| If the conversion fails, print error message for macro MACRO. Return |
| TRUE iff conversion succeeds. |
`--------------------------------------------------------------------------*/
static const char *
skip_space (const char *arg)
{
while (IS_SPACE (*arg))
arg++;
return arg;
}
开发者ID:thewml,项目名称:wml,代码行数:12,代码来源:devel.c
示例19: getAnchorText
char *
getAnchorText(Buffer *buf, AnchorList *al, Anchor *a)
{
int hseq, i;
Line *l;
Str tmp = NULL;
char *p, *ep;
if (!a || a->hseq < 0)
return NULL;
hseq = a->hseq;
l = buf->firstLine;
for (i = 0; i < al->nanchor; i++) {
a = &al->anchors[i];
if (a->hseq != hseq)
continue;
for (; l; l = l->next) {
if (l->linenumber == a->start.line)
break;
}
if (!l)
break;
p = l->lineBuf + a->start.pos;
ep = l->lineBuf + a->end.pos;
for (; p < ep && IS_SPACE(*p); p++) ;
if (p == ep)
continue;
if (!tmp)
tmp = Strnew_size(ep - p);
else
Strcat_char(tmp, ' ');
Strcat_charp_n(tmp, p, ep - p);
}
return tmp ? tmp->ptr : NULL;
}
开发者ID:yujiabe,项目名称:w3m,代码行数:35,代码来源:anchor.c
示例20: SKIP_SPACE
static char *xml_meta_attr_name(ACL_XML2_ATTR *attr, char *data)
{
int ch;
ACL_XML2 *xml = attr->node->xml;
SKIP_SPACE(data);
if (*data == 0)
return data;
if (attr->name == xml->addr)
attr->name = data;
while ((ch = *data) != 0) {
if (ch == '=') {
if (attr->name_size == 0)
attr->name_size = data - attr->name;
*data++ = 0;
break;
}
if (IS_SPACE(ch)) {
attr->name_size = data - attr->name;
*data++ = 0;
} else
data++;
}
return data;
}
开发者ID:lunlun1992,项目名称:acl,代码行数:28,代码来源:acl_xml2_parse.c
注:本文中的IS_SPACE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论