pike.git/
src/
builtin.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2010-01-02
2010-01-02 13:24:19 by Stephen R. van den Berg <srb@cuci.nl>
d6206fc3fbad546795bb408f755b676f3d54d484 (
43
lines) (+
24
/-
19
)
[
Show
|
Annotate
]
Branch:
7.9
Separate code paths to help compiler and reader.
Rev: src/builtin.cmod:1.243
2:
|| This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: builtin.cmod,v 1.
242
2010/01/02 13:
17
:
10
srb Exp $
+
|| $Id: builtin.cmod,v 1.
243
2010/01/02 13:
24
:
19
srb Exp $
*/ #include "global.h"
790:
switch (shift) { #define DO_IT(TYPE) \ { TYPE *start = src, *end = start+len, *dst = (void*)sb.s->str; \
-
for (; start < end; start++) { \
-
unsigned chr = *start; \
+
if (!ws) { \
-
+
for (; start < end; start++) { \
+
unsigned chr = *start; \
if (!DO_IT_SPACECHECK(chr)) \ break; \
-
} else { \
-
char *p = ws; \
-
do { \
-
if (*p == chr) \
-
goto lead##TYPE; \
-
} while(*++p); \
-
break; \
+
} \
-
lead##TYPE:; \
-
} \
+
for (; start < end; start++) { \
-
unsigned chr = *start;
\
-
if (!ws) { \
+
unsigned chr = *start; \
if (DO_IT_SPACECHECK(chr)) \ if (foundspace) \ continue; \
815:
foundspace=1,chr=' '; \ else \ foundspace=0; \
-
} else { \
+
*dst++ = chr; \
+
}
\
+
}
else {
\
+
for (; start < end; start++) { \
+
unsigned chr = *start; \
char *p = ws; \ do { \ if (*p == chr) \
-
+
goto lead##TYPE; \
+
} while(*++p); \
+
break; \
+
lead##TYPE:; \
+
} \
+
for (; start < end; start++) { \
+
unsigned chr = *start; \
+
char *p = ws; \
+
do { \
+
if (*p == chr) \
if (foundspace) \ goto skip##TYPE; \ else { \
831:
goto lead##TYPE; \ } \ foundspace=0; \
-
} \
+
copy##TYPE: \ *dst++ = chr; \ skip##TYPE:; \
-
+
} \
} \ len = dst - (TYPE*)sb.s->str; \ }