pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:24:
#include "bignum.h" #include "main.h" #include "operators.h" #include "builtin_functions.h" #include "fsort.h" #include "port.h" #include "gc.h" #include "block_allocator.h" #include "pikecode.h" #include "opcodes.h"
+
#include "whitespace.h"
#include <ctype.h> #include <errno.h> #include <math.h> DECLARATIONS /*! @module System */
pike.git/src/builtin.cmod:1520:
ws = wstemp; } } else ws = 0; init_string_builder_alloc (&sb, len, bshift); if(bshift == shift) sb.known_shift = bshift; }
-
#define SPACECASE8 \
-
case ' ':case '\t':case '\r':case '\n':case '\v':case '\f': \
-
case 0x85:case 0xa0:
-
#include "whitespace.h"
+
switch (shift) { #define NORMALISE_TIGHT_LOOP(TYPE,CASE) \ { \ const TYPE *start = src, *end = start+len; \ if (!ws) { \ TYPE *dst = (void*)sb.s->str; \ for (; start < end; start++) { \ switch(*start) { \ CASE \
pike.git/src/builtin.cmod:1588:
} \ string_builder_putchar(&sb, chr); foundspace=0; \ skip##TYPE:; \ } \ } \ } case 0: NORMALISE_TIGHT_LOOP (p_wchar0,SPACECASE8); break; case 1: NORMALISE_TIGHT_LOOP (p_wchar1,SPACECASE16); break; case 2: NORMALISE_TIGHT_LOOP (p_wchar2,SPACECASE16); break; #undef NORMALISE_TIGHT_LOOP
-
#undef SPACECASE8
-
#undef SPACECASE16
+
} if (wstemp) free(wstemp); if (foundspace) sb.s->len--; RETURN finish_string_builder (&sb); } /*! @decl string trim_all_whites (string s) *! @belongs String
pike.git/src/builtin.cmod:1613:
*! white spaces defined in Unicode) from the string @[s]. */ PMOD_EXPORT PIKEFUN string string_trim_all_whites (string s) errname String.trim_all_whites; optflags OPT_TRY_OPTIMIZE; { ptrdiff_t start = 0, end = s->len; int chr; switch (s->size_shift) {
-
#define SPACECASE8 \
-
case ' ':case '\t':case '\r':case '\n':case '\v':case '\f': \
-
case 0x85:case 0xa0:
-
#include "whitespace.h"
+
#define DO_IT(TYPE,CASE) \ { \ for (; start < end; start++) { \ chr = ((TYPE *) s->str)[start]; \ switch(chr) { \ CASE \ continue; \ } \ break; \
pike.git/src/builtin.cmod:1641:
CASE \ continue; \ } \ break; \ } \ } case 0: DO_IT (p_wchar0,SPACECASE8); break; case 1: DO_IT (p_wchar1,SPACECASE16); break; case 2: DO_IT (p_wchar2,SPACECASE16); break; #undef DO_IT
-
#undef SPACECASE8
-
#undef SPACECASE16
+
} RETURN string_slice (s, start, end + 1 - start); } /*! @decl string status(int verbose) *! @belongs String *! *! Get string table statistics. *! *! @returns