pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:133:    PIKEVAR int compat_major;    PIKEVAR int compat_minor;    /* NB: data is marked private to ensure that pike level code can't    * remove its references while we hold pointers into it.    */    PIKEVAR string data flags ID_PRIVATE|ID_PROTECTED;    PIKEVAR string prefix;    PIKEVAR int picky_cpp;    PIKEVAR int keep_comments;    PIKEVAR int dependencies_fail; +  PIKEVAR int auto_convert;       INIT    {    init_string_builder(&THIS->buf, 0);    }       EXIT    {    /* NOTE: Most of the fields are mapped, and thus freed automatically. */   
pike.git/src/cpp.cmod:2125:    if( whole && len != remain && wide_isidchar(INDEX_PCHARP(stack,len)) )    return 0;       return 1;   }      static ptrdiff_t low_cpp(struct CPP_struct *this,    PCHARP data,    ptrdiff_t len,    int flags, -  int auto_convert, +     struct pike_string *charset);   static void insert_callback_define(struct CPP_struct *this,    struct define_struct *def,    struct pike_string *arg,    struct string_builder *tmp);   static void insert_callback_define_no_args(struct CPP_struct *this,    struct define_struct *def,    struct pike_string *arg,    struct string_builder *tmp);   static void insert_pragma(struct CPP_struct *this,
pike.git/src/cpp.cmod:2817:    }    }    if (l) {    string_builder_append(s,a,l);    }   }      static void apply_define(struct CPP_struct *this,    struct define_struct *d,    struct define_argument *arguments, -  short flags, short auto_convert, +  short flags,    struct pike_string *charset)   {    struct string_builder tmp;       init_string_builder(&tmp, 0);    if(d->magic)    {    int i;    struct pike_string *a = NULL;    if (d->args > 0) {
pike.git/src/cpp.cmod:2892:    string_builder_append( &tmp, a, l );    }else{    struct string_builder save;    INT_TYPE line = this->current_line;    /* FIXME: Shouldn't we save current_file too? */    save=this->buf;    this->buf=tmp;    d->flags = CPP_MACRO_IN_USE;    low_cpp(this, a, l,    flags & ~(CPP_EXPECT_ENDIF | CPP_EXPECT_ELSE), -  auto_convert, charset); +  charset);    d->flags = flags;    tmp=this->buf;    this->buf=save;    this->current_line=line;    }    }       if(!(argument & DEF_ARG_NOPOSTSPACE))    string_builder_putchar(&tmp, ' ');    }
pike.git/src/cpp.cmod:2929:    SET_INDEX_CHARP(tmp.s->str,e,tmp.s->size_shift,' ');    }       d->flags = CPP_MACRO_DISABLED;    /* FIXME: Ought to add a ref to d here. */       string_builder_putchar(&tmp, 0);    tmp.s->len--;    low_cpp(this, MKPCHARP_STR(tmp.s),tmp.s->len,    flags & ~(CPP_EXPECT_ENDIF | CPP_EXPECT_ELSE), -  auto_convert, charset); +  charset);       d->flags = flags;    /* FIXME: Ought to free the ref to d here. */       free_string_builder(&tmp);   }      #include "preprocessor.h"      /*** Magic defines ***/
pike.git/src/cpp.cmod:3356:    struct object *cpp_obj = fast_clone_object(CPP_program);    struct CPP_struct *this =    (struct CPP_struct *)get_storage(cpp_obj, CPP_program);    struct svalue *save_sp = Pike_sp - args;    struct mapping *predefs = NULL;       struct pike_string *prefix = NULL;       struct pike_string *current_file = 0;    -  int auto_convert = 0; +     struct pike_string *charset = NULL;       int compat_major = compat_major_sv?compat_major_sv->u.integer:0;    int compat_minor = compat_minor_sv?compat_minor_sv->u.integer:0;    int picky_cpp = picky_cpp_sv?picky_cpp_sv->u.integer:0;      #ifdef PIKE_DEBUG    ONERROR tmp;   #endif /* PIKE_DEBUG */       push_object(cpp_obj);       this->prefix = NULL;    this->current_line=1;    this->compile_errors=0;    this->defines = allocate_mapping(32);    this->keep_comments = 0;    this->dependencies_fail = 0; -  +  this->auto_convert = 0;       if (opts_or_file) {    if (TYPEOF(*opts_or_file) == PIKE_T_MAPPING) {    struct svalue *tmp;    struct mapping *m = opts_or_file->u.mapping;      #define GET_TYPE(type, name) ((tmp = simple_mapping_string_lookup(m, name)) \    && (TYPEOF(*(tmp)) == PIKE_T_##type || (Pike_error("Expected type %s,"\    "got type %s for " name ".", get_name_of_type(PIKE_T_##type), get_name_of_type(TYPEOF(*tmp))), 0)))   
pike.git/src/cpp.cmod:3447:    this->compat_handler, 2, BIT_STRING)) {    cpp_handle_exception (this, "Error decoding with charset %S",    charset);    Pike_error("Unknown charset.\n");    }    this->data = data = Pike_sp[-1].u.string;    Pike_sp--;    dmalloc_touch_svalue(Pike_sp);    }    else if(TYPEOF(*charset_sv) == T_INT) -  auto_convert = charset_sv->u.integer; +  this->auto_convert = charset_sv->u.integer;    else {    SIMPLE_ARG_TYPE_ERROR("cpp", 3, "string|int");    }    }       if(compat_major)    cpp_change_compat(this, compat_major, compat_minor);       this->picky_cpp = picky_cpp;   
pike.git/src/cpp.cmod:3506:    }    if (!predefs) {    predef_map_error:    f_sprintf (sprintf_args);    Pike_error("%S", Pike_sp[-1].u.string);    }    }    pop_stack();    }    -  if (auto_convert && (!data->size_shift) && (data->len > 1)) { +  if (this->auto_convert && (!data->size_shift) && (data->len > 1)) {    /* Try to determine if we need to recode the string */    struct pike_string *new_data = recode_string(this, data);    free_string(data);    this->data = data = new_data;    }    if (data->size_shift) {    /* Get rid of any byte order marks (0xfeff) */    struct pike_string *new_data = filter_bom(data);    free_string(data);    this->data = data = new_data;
pike.git/src/cpp.cmod:3627:    PUSH_STRING_SHIFT(this->current_file->str, this->current_file->len,    this->current_file->size_shift, &this->buf);    string_builder_putchar(&this->buf, '\n');      #ifdef PIKE_DEBUG    SET_ONERROR(tmp, fatal_on_error, "Preprocessor exited with longjump!\n");   #endif /* PIKE_DEBUG */          low_cpp(this, MKPCHARP_STR(data), data->len, -  0, auto_convert, charset); +  0, charset);      #ifdef PIKE_DEBUG    UNSET_ONERROR(tmp);   #endif /* PIKE_DEBUG */       if(this->compile_errors)    {    throw_error_object(fast_clone_object(cpp_error_program), 0, 0, 0,    "Cpp() failed\n");    }