Branch: Tag:

2018-08-17

2018-08-17 09:36:02 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Cpp: Added cpp_error().

478:    *! same arguments.    *!    *! @seealso -  *! @[Reporter()->report()] +  *! @[Reporter()->report()], @[cpp_error()]    */   PIKEFUN void report(int(0..3) severity,    string filename, int(1..) linenumber,
554:    va_end(args);   }    +  /*! @decl void cpp_error(sprintf_format msg, sprintf_args ... arguments) +  *! +  *! Convenience function for reporting a cpp error at +  *! the current position. +  *! +  *! This function calls @[report()] with the same arguments, +  *! but prefixed with suitable defaults. +  *! +  *! @seealso +  *! @[report()] +  */ +  PIKEFUN void cpp_error(sprintf_format msg, sprintf_args ... arguments) +  { +  struct CPP_struct *this = THIS; +  struct svalue *first_arg = Pike_sp-args; +  INT32 i; +  +  push_int(REPORT_ERROR); +  ref_push_string(this->current_file); +  push_int(this->current_line); +  push_constant_text("cpp"); +  for (i = 0; i < args; i++) { +  push_svalue(first_arg + i); +  } +  apply_current(f_CPP_report_fun_num, 4 + args); +  } +     /*! @decl string format_exception(mixed err)    *!    *! Format an exception caught by cpp as a