pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:908:    }    if (this->compat_handler) {    ref_push_object(this->compat_handler);    } else {    push_undefined();    }       apply_external(1, CE_RESOLV_FUN_NUM, 4);   }    +  PIKEFUN string decode_charset(string data, string charset) +  { +  struct CPP_struct *this = THIS; +  low_unsafe_apply_handler("decode_charset", +  this->handler, this->compat_handler, args); +  } +     /*! @decl string evaluate_define(string def, string|void arguments)    *!    *! Evaluate the #define named @[def] with @[arguments].    *!    *! @param def    *! Name of the macro.    *!    *! @param arguments    *! Raw string of the contents between the parenthesis    *! for function-style maros. @[UNDEFINED] or left out
pike.git/src/cpp.cmod:2262:    }       new_str = begin_shared_string(len);       memcpy(new_str->str, data->str, len);       push_string(end_shared_string(new_str));       push_static_text("ebcdic-us");    -  if (safe_apply_handler ("decode_charset", this->handler, this->compat_handler, -  2, BIT_STRING)) { +  if (safe_apply_current(f_CPP_decode_charset_fun_num, 2) && +  (TYPEOF(Pike_sp[-1]) == PIKE_T_STRING)) {    /* Various consistency checks. */    if ((Pike_sp[-1].u.string->size_shift) ||    (((size_t)Pike_sp[-1].u.string->len) < CONSTANT_STRLEN("#charset")) ||    (Pike_sp[-1].u.string->str[0] != '#')) {    pop_stack();    return data;    }    }    else {    cpp_handle_exception (this, "Error decoding with charset 'ebcdic-us'");
pike.git/src/cpp.cmod:2334:       new_str = begin_shared_string(len);       memcpy(new_str->str, p, len);       pop_stack();    ref_push_string(new_str = end_shared_string(new_str));       /* Decode the string */    -  if (!safe_apply_handler ("decode_charset", this->handler, this->compat_handler, -  2, BIT_STRING)) { +  if (!safe_apply_current(f_CPP_decode_charset_fun_num, 2) || +  (TYPEOF(Pike_sp[-1]) != PIKE_T_STRING)) {    cpp_handle_exception (this, "Error decoding with charset %S", new_str);    free_string (new_str);    return data;    }    free_string (new_str);       /* Accept the new string */       free_string(data);    add_ref(data = Pike_sp[-1].u.string);
pike.git/src/cpp.cmod:3907:    &this->buf);    }else{    /* #include */    if (this->auto_convert) {    struct pike_string *new_str =    recode_string(this, Pike_sp[-1].u.string);    free_string(Pike_sp[-1].u.string);    Pike_sp[-1].u.string = new_str;    } else if (charset) {    ref_push_string(charset); -  if (!safe_apply_handler ("decode_charset", -  this->handler, this->compat_handler, -  2, BIT_STRING)) { +  if (!safe_apply_current(f_CPP_decode_charset_fun_num, 2) || +  (TYPEOF(Pike_sp[-1]) != PIKE_T_STRING)) {    cpp_handle_exception (this,    "Charset decoding failed for included file.");    pop_n_elems(Pike_sp - save_sp);    break;    }    }    if (Pike_sp[-1].u.string->size_shift) {    /* Get rid of any byte order marks (0xfeff) */    struct pike_string *new_str = filter_bom(Pike_sp[-1].u.string);    free_string(Pike_sp[-1].u.string);
pike.git/src/cpp.cmod:4406:    while(DATA(pos) && !wide_isspace(DATA(pos))) {    pos++;    }       if (pos != p) {    /* The rest of the string. */    push_string( make_shared_binary_pcharp( ADD_PCHARP(data,pos), len-pos ) );    /* The charset name */    push_string( make_shared_binary_pcharp( ADD_PCHARP(data,p),pos-p));    -  if (!safe_apply_handler ("decode_charset", this->handler, this->compat_handler, -  2, BIT_STRING)) { +  if (!safe_apply_current(f_CPP_decode_charset_fun_num, 2) || +  (TYPEOF(Pike_sp[-1]) != PIKE_T_STRING)) {    cpp_handle_exception (this, NULL);    } else {    low_cpp(this, MKPCHARP_STR(Pike_sp[-1].u.string),Pike_sp[-1].u.string->len,    flags, charset);    pop_stack();    }    /* FIXME: Is this the correct thing to return? */    return len;    } else {    cpp_error(this, "What charset?");
pike.git/src/cpp.cmod:5409:    (struct CPP_struct *)get_storage(cpp_obj, CPP_program);    struct mapping *predefs = NULL;       push_object(cpp_obj);       apply(cpp_obj, "init_pike_cpp", 0);       if (this->charset) {    ref_push_string(data);    ref_push_string(this->charset); -  if (!safe_apply_handler ("decode_charset", this->handler, -  this->compat_handler, 2, BIT_STRING)) { +  if (!safe_apply_current(f_CPP_decode_charset_fun_num, 2) || +  (TYPEOF(Pike_sp[-1]) != PIKE_T_STRING)) {    cpp_handle_exception (this, "Error decoding with charset %S",    THIS->charset);    Pike_error("Unknown charset.\n");    }    data = Pike_sp[-1].u.string;    /* NB: We let the stack hold the references to data.    * We don't need to keep track of the number of elements    * on the stack as we have the save_sp marker.    */    }