pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:376:    PIKEVAR int dependencies_fail;    PIKEVAR int auto_convert;       PIKEVAR mapping(string:function(string:string)) directives flags ID_PROTECTED;       static int f_inherited_Reporter_report_fun_num = -1;       INIT    {    init_string_builder(&THIS->buf, 0); +  THIS->current_line = 1;    }       EXIT    {    /* NOTE: Most of the fields are mapped, and thus freed automatically. */       if (THIS->buf.s) {    free_string_builder(&THIS->buf);    }    }
pike.git/src/cpp.cmod:4919:       struct pike_string *prefix = NULL;       struct pike_string *current_file = 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; +  int add_line_directive = this->current_line != 1;       this->prefix = NULL;    this->current_line=1;    this->compile_errors=0; -  +  if (this->defines) { +  free_mapping(this->defines); +  this->defines = NULL; /* Paranoia */ +  }    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;   
pike.git/src/cpp.cmod:4951:    if (GET_TYPE(INT, "compat_minor")) compat_minor = tmp->u.integer;    if (GET_TYPE(INT, "picky")) picky_cpp = tmp->u.integer;    if (GET_TYPE(STRING, "prefix")) prefix = tmp->u.string;    if (GET_TYPE(INT, "keep_comments")) this->keep_comments = tmp->u.integer;   #undef GET_TYPE    } else if (TYPEOF(*opts_or_file) == PIKE_T_STRING) {    current_file = opts_or_file->u.string;    }    }    -  if(current_file) +  if(current_file) {    add_ref(current_file); -  else +  if (this->current_file != current_file) add_line_directive = 1; +  } else {    current_file = make_shared_string("-"); -  +  if (this->current_file && (this->current_file != current_file)) { +  add_line_directive = 1; +  } +  } +  if (this->current_file) { +  free_string(this->current_file); +  }    this->current_file = current_file;    -  +  if (add_line_directive) { +  string_builder_binary_strcat(&this->buf, "#line 1 ", 8); +  PUSH_STRING_SHIFT(current_file->str, +  current_file->len, +  current_file->size_shift, +  &this->buf); +  string_builder_putchar(&this->buf, '\n'); +  } +     this->compat_major=PIKE_MAJOR_VERSION;    this->compat_minor=PIKE_MINOR_VERSION; -  +  if (this->compat_handler) { +  free_object(this->compat_handler); +  }    this->compat_handler = 0; -  +  if (this->handler) { +  free_object(this->handler); +  }    this->handler = handler;    if(handler)    add_ref(handler);    -  +  if (this->prefix) { +  free_string(this->prefix); +  this->prefix = NULL; +  }    if (prefix) {    int i;    if (prefix->size_shift) {    Pike_error("No widechars allowed in cpp prefix.\n");    }    for (i = 0; i < prefix->len; i++) {    if (!wide_isidchar(prefix->str[i])) {    Pike_error("Invalid char in prefix.\n");    }    }    this->prefix = prefix;    add_ref(prefix);    }    -  +  if (this->charset) { +  free_string(this->charset); +  this->charset = NULL; +  }    if(charset_sv) {    if(TYPEOF(*charset_sv) == T_STRING) {    this->charset = charset_sv->u.string;    add_ref(this->charset);    }    else if(TYPEOF(*charset_sv) == T_INT)    this->auto_convert = charset_sv->u.integer;    else {    SIMPLE_ARG_TYPE_ERROR("cpp", 3, "string|int");    }
pike.git/src/cpp.cmod:5289:    if (data->size_shift) {    /* Get rid of any byte order marks (0xfeff) */    data = filter_bom(data);    push_string(data);    /* 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.    */    }    -  string_builder_binary_strcat(&this->buf, "#line 1 ", 8); -  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 */       ref_push_string(data); /* data */    push_int(0); /* flags */    apply(cpp_obj, "low_cpp", 2);      #ifdef PIKE_DEBUG    UNSET_ONERROR(tmp);