pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1:   /*   || 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_functions.c,v 1.659 2008/05/02 04:15:09 mast Exp $ + || $Id: builtin_functions.c,v 1.660 2008/05/03 15:29:24 nilsson Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"
pike.git/src/builtin_functions.c:329:    switch(s->size_shift) {    case 0:    i = simple_hashmem(STR0(s), s->len, 100);    break;    case 1:    i = simple_hashmem1(STR1(s), s->len, 100);    break;    case 2:    i = simple_hashmem2(STR2(s), s->len, 100);    break; + #ifdef PIKE_DEBUG    default:    Pike_fatal("hash(): Unsupported string shift: %d\n", s->size_shift);    break; -  + #endif    }       if(args > 1)    {    if(Pike_sp[1-args].type != T_INT)    SIMPLE_BAD_ARG_ERROR("hash",2,"int");       if(Pike_sp[1-args].u.integer <= 0)    PIKE_ERROR("hash", "Modulo < 1.\n", Pike_sp, args);   
pike.git/src/builtin_functions.c:491:   #define DO_LOWER_CASE(C) do {\    INT32 c = C; \    if(c<0xb5){if(c >= 'A' && c <= 'Z' ) C=c+0x20;}else {\    struct case_info *ci = find_ci(c); \    if (ci) { \    switch(ci->mode) { \    case CIM_NONE: case CIM_LOWERDELTA: break; \    case CIM_UPPERDELTA: C = c + ci->data; break; \    case CIM_CASEBIT: C = c | ci->data; break; \    case CIM_CASEBITOFF: C = ((c - ci->data) | ci->data) + ci->data; break; \ -  default: Pike_fatal("lower_case(): Unknown case_info mode: %d\n", ci->mode); \ +  DO_IF_DEBUG( default: Pike_fatal("lower_case(): Unknown case_info mode: %d\n", ci->mode); ) \    } \    }} \    } while(0)      #define DO_LOWER_CASE_SHIFT0(C) do {\    INT32 c = C; \    if(c<0xb5){if(c >= 'A' && c <= 'Z' ) C=c+0x20;}else {\    struct case_info *ci = find_ci_shift0(c); \    if (ci) { \    switch(ci->mode) { \    case CIM_NONE: case CIM_LOWERDELTA: break; \    case CIM_UPPERDELTA: C = c + ci->data; break; \    case CIM_CASEBIT: C = c | ci->data; break; \    case CIM_CASEBITOFF: C = ((c - ci->data) | ci->data) + ci->data; break; \ -  default: Pike_fatal("lower_case(): Unknown case_info mode: %d\n", ci->mode); \ +  DO_IF_DEBUG( default: Pike_fatal("lower_case(): Unknown case_info mode: %d\n", ci->mode); ) \    } \    }} \    } while(0)      #define DO_UPPER_CASE(C) do {\    INT32 c = C; \    if(c<0xb5){if(c >= 'a' && c <= 'z' ) C=c-0x20;}else {\    struct case_info *ci = find_ci(c); \    if (ci) { \    switch(ci->mode) { \    case CIM_NONE: case CIM_UPPERDELTA: break; \    case CIM_LOWERDELTA: C = c - ci->data; break; \    case CIM_CASEBIT: C = c & ~ci->data; break; \    case CIM_CASEBITOFF: C = ((c - ci->data)& ~ci->data) + ci->data; break; \ -  default: Pike_fatal("upper_case(): Unknown case_info mode: %d\n", ci->mode); \ +  DO_IF_DEBUG( default: Pike_fatal("upper_case(): Unknown case_info mode: %d\n", ci->mode); ) \    } \    }} \    } while(0)      #define DO_UPPER_CASE_SHIFT0(C) do {\    INT32 c = C; \    if(c<0xb5){if(c >= 'a' && c <= 'z' ) C=c-0x20;}else {\    struct case_info *ci = find_ci_shift0(c); \    if (ci) { \    switch(ci->mode) { \    case CIM_NONE: case CIM_UPPERDELTA: break; \    case CIM_LOWERDELTA: C = c - ci->data; break; \    case CIM_CASEBIT: C = c & ~ci->data; break; \    case CIM_CASEBITOFF: C = ((c - ci->data)& ~ci->data) + ci->data; break; \ -  default: Pike_fatal("lower_case(): Unknown case_info mode: %d\n", ci->mode); \ +  DO_IF_DEBUG( default: Pike_fatal("lower_case(): Unknown case_info mode: %d\n", ci->mode); ) \    } \    }} \    } while(0)      /*! @decl string lower_case(string s)    *! @decl int lower_case(int c)    *!    *! Convert a string or character to lower case.    *!    *! @returns
pike.git/src/builtin_functions.c:602:       while(i--) {    DO_LOWER_CASE(str[i]);    }    } else if (orig->size_shift == 2) {    p_wchar2 *str = STR2(ret);       while(i--) {    DO_LOWER_CASE(str[i]);    } + #ifdef PIKE_DEBUG    } else {    Pike_fatal("lower_case(): Bad string shift:%d\n", orig->size_shift); -  + #endif    }       pop_n_elems(args);    push_string(end_shared_string(ret));   }      /*! @decl string upper_case(string s)    *! @decl int upper_case(int c)    *!    *! Convert a string or character to upper case.
pike.git/src/builtin_functions.c:699:       while(i--) {    DO_UPPER_CASE(str[i]);    }    } else if (orig->size_shift == 2) {    p_wchar2 *str = STR2(ret);       while(i--) {    DO_UPPER_CASE(str[i]);    } + #ifdef PIKE_DEBUG    } else {    Pike_fatal("lower_case(): Bad string shift:%d\n", orig->size_shift); -  + #endif    }       pop_n_elems(args);    push_string(end_shared_string(ret));   }      /*! @decl string random_string(int len)    *!    *! Returns a string of random characters 0-255 with the length @[len].    */
pike.git/src/builtin_functions.c:894:    break;    case 2:    {    p_wchar2 *str = STR2(haystack);    while (start < haystack->len) {    if (str[start] == (p_wchar2)val) break;    start++;    }    }    break; + #ifdef PIKE_DEBUG    default:    Pike_fatal("search(): Unsupported string shift: %d!\n",    haystack->size_shift);    break; -  + #endif    }    if (start >= haystack->len) {    start = -1;    }    } else {    SIMPLE_BAD_ARG_ERROR("search", 2, "string | int");    }    pop_n_elems(args);    push_int64(start);    break;
pike.git/src/builtin_functions.c:1600: Inside #if defined(PIKE_DEBUG)
   }   #ifdef PIKE_DEBUG    if (j) {    Pike_fatal("string_to_unicode(): Indexing error: len:%ld, j:%ld.\n",    PTRDIFF_T_TO_LONG(len), PTRDIFF_T_TO_LONG(j));    }   #endif /* PIKE_DEBUG */    out = end_shared_string(out);    }    break; + #ifdef PIKE_DEBUG    default: -  Pike_error("string_to_unicode(): Bad string shift: %d!\n", in->size_shift); +  Pike_fatal("string_to_unicode(): Bad string shift: %d!\n", in->size_shift);    break; -  + #endif    }    pop_n_elems(args);    push_string(out);   }      /*! @decl string unicode_to_string(string(0..255) s)    *!    *! Converts an UTF16 byte-stream into a string.    *!    *! @note