pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:2959:       d->flags = flags;    /* FIXME: Ought to free the ref to d here. */       free_string_builder(&tmp);   }      /*    * Preprocessor template.    * +  * NB: There are two basic cases where this function is called: +  * +  * * Either when switching to a new input data string +  * (eg macro expansion or #include). The result of +  * this is added to the current buffer. +  * +  * * Or parsing to the end of the line after a directive. +  * The result of this is added to a temporary buffer.    */   static ptrdiff_t low_cpp(struct CPP_struct *this,    PCHARP data,    ptrdiff_t len,    int flags,    struct pike_string *charset)   {    ptrdiff_t pos, tmp, e;    int include_mode;    INT_TYPE first_line = this->current_line;
pike.git/src/cpp.cmod:4245:    if(flags & CPP_EXPECT_ENDIF) {    INT_TYPE saved_line = this->current_line;    this->current_line = first_line;    cpp_error(this, "End of file while searching for #endif.");    this->current_line = saved_line;    }       return pos;   }    -  PIKEFUN void cpp(string data, int flags) +  PIKEFUN void low_cpp(string data, int flags)    {    low_cpp(THIS, MKPCHARP_STR(data), data->len, flags, THIS->charset);    }    -  +  PIKEFUN string cpp(string data, int flags) +  { +  struct CPP_struct *this = THIS; +  struct string_builder save_buf = this->buf; +  struct pike_string *save_file = this->current_file; +  INT_TYPE save_line = this->current_line; +  +  if (save_file) add_ref(save_file); +  init_string_builder(&this->buf, 0); +  +  low_cpp(this, MKPCHARP_STR(data), data->len, flags, THIS->charset); +  +  push_string(finish_string_builder(&this->buf)); +  +  this->buf = save_buf; +  if (this->current_file) free_string(this->current_file); +  this->current_file = save_file; +  this->current_line = save_line; +  } +    /*** Magic defines ***/      /*! @decl constant __LINE__    *!    *! This define contains the current line number, represented as an    *! integer, in the source file.    */   static void insert_current_line(struct CPP_struct *this,    struct define_struct *UNUSED(def),    struct pike_string *UNUSED(arg),
pike.git/src/cpp.cmod:4959:    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, "cpp", 2); +  apply(cpp_obj, "low_cpp", 2);      #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");    }