pike.git / src / error.c

version» Context lines:

pike.git/src/error.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: error.c,v 1.104 2003/03/28 22:00:46 mast Exp $ + || $Id: error.c,v 1.105 2003/04/01 14:24:19 mast Exp $   */      #define NO_PIKE_SHORTHAND   #include "global.h"   #include "svalue.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "interpret.h"   #include "stralloc.h"   #include "builtin_functions.h"   #include "array.h"   #include "object.h"   #include "main.h"   #include "builtin_functions.h"   #include "backend.h"   #include "operators.h"   #include "module_support.h"   #include "threads.h"   #include "gc.h"    - RCSID("$Id: error.c,v 1.104 2003/03/28 22:00:46 mast Exp $"); + RCSID("$Id: error.c,v 1.105 2003/04/01 14:24:19 mast Exp $");      #undef ATTRIBUTE   #define ATTRIBUTE(X)      PMOD_EXPORT const char msg_fatal_error[] =    "%s:%d: Fatal error:\n";   #ifdef PIKE_DEBUG   PMOD_EXPORT const char msg_unsetjmp_nosync_1[] =    "UNSETJMP out of sync! (last SETJMP at %s)!\n";   PMOD_EXPORT const char msg_unsetjmp_nosync_2[] =
pike.git/src/error.c:745:   PMOD_EXPORT DECLSPEC(noreturn) void bad_arg_error(    const char *func,    struct svalue *base_sp, int args,    int which_arg,    const char *expected_type,    struct svalue *got,    const char *desc, ...) ATTRIBUTE((noreturn,format (printf, 7, 8)))   {    INIT_ERROR(bad_arg);    ERROR_COPY(bad_arg, which_arg); +  if (expected_type)    ERROR_STRUCT(bad_arg,o)->expected_type=make_shared_string(expected_type); -  +  else +  ERROR_STRUCT(bad_arg,o)->expected_type = NULL;    if(got)    {    ERROR_COPY_SVALUE(bad_arg, got);    }else{    ERROR_STRUCT(bad_arg,o)->got.type=PIKE_T_INT;    ERROR_STRUCT(bad_arg,o)->got.subtype=NUMBER_UNDEFINED;    ERROR_STRUCT(bad_arg,o)->got.u.integer=0;    }    DWERROR((stderr, "%s():Bad arg %d (expected %s)\n",    func, which_arg, expected_type));    ERROR_DONE(generic);   }    - /* This one doesn't record an expected type. */ - PMOD_EXPORT DECLSPEC(noreturn) void bad_arg_error_2( -  const char *func, -  struct svalue *base_sp, int args, -  int which_arg, -  struct svalue *got, -  const char *desc, ...) ATTRIBUTE((noreturn,format (printf, 7, 8))) - { -  INIT_ERROR(bad_arg); -  ERROR_COPY(bad_arg, which_arg); -  ERROR_STRUCT(bad_arg,o)->expected_type=NULL; -  if(got) -  { -  ERROR_COPY_SVALUE(bad_arg, got); -  }else{ -  ERROR_STRUCT(bad_arg,o)->got.type=PIKE_T_INT; -  ERROR_STRUCT(bad_arg,o)->got.subtype=NUMBER_UNDEFINED; -  ERROR_STRUCT(bad_arg,o)->got.u.integer=0; -  } -  DWERROR((stderr, "%s():Bad arg %d\n", -  func, which_arg)); -  ERROR_DONE(generic); - } -  +    PMOD_EXPORT DECLSPEC(noreturn) void math_error(    const char *func,    struct svalue *base_sp, int args,    struct svalue *number,    const char *desc, ...) ATTRIBUTE((noreturn,format (printf, 5, 6)))   {    INIT_ERROR(math);    if(number)    {    ERROR_COPY_SVALUE(math, number);
pike.git/src/error.c:831:    INIT_ERROR(permission);    ERROR_STRUCT(permission,o)->permission_type=    make_shared_string(permission_type);    ERROR_DONE(generic);   }      PMOD_EXPORT void wrong_number_of_args_error(const char *name, int args, int expected)   {    if(expected>args)    { -  bad_arg_error_2 (name, Pike_sp-args, args, expected, NULL, +  bad_arg_error (name, Pike_sp-args, args, expected, NULL, NULL,    "Too few arguments to %s(). Expected at least %d.\n",    name, expected);    }else { -  bad_arg_error_2 (name, Pike_sp-args, args, expected, NULL, +  bad_arg_error (name, Pike_sp-args, args, expected, NULL, NULL,    "Too many arguments to %s(). Expected at most %d.\n",    name, expected);    }   }      #ifdef PIKE_DEBUG   static void gc_check_throw_value(struct callback *foo, void *bar, void *gazonk)   {    debug_gc_xmark_svalues(&throw_value,1," in the throw value");   }