diff --git a/src/error.c b/src/error.c index dd88ed5c1c26c353fba328bde806aaaf1dbc98e0..13bfd78d0bfd6f97472890431301fe704288b689 100644 --- a/src/error.c +++ b/src/error.c @@ -18,7 +18,7 @@ #include "operators.h" #include "module_support.h" -RCSID("$Id: error.c,v 1.26 1999/03/19 11:39:08 hubbe Exp $"); +RCSID("$Id: error.c,v 1.27 1999/03/20 22:24:30 hubbe Exp $"); #undef ATTRIBUTE #define ATTRIBUTE(X) @@ -437,6 +437,27 @@ void bad_arg_error( ERROR_DONE(generic); } +void math_error( + char *func, + struct svalue *base_sp, int args, + char *desc, ...) ATTRIBUTE((noreturn,format (printf, 4, 5))) +{ + INIT_ERROR(math); + ERROR_DONE(generic); +} + +void resource_error( + char *func, + struct svalue *base_sp, int args, + char *resource_type, + long howmuch, + char *desc, ...) ATTRIBUTE((noreturn,format (printf, 6, 7))) +{ + INIT_ERROR(resource); + ERROR_COPY(resource,howmuch); + ERROR_STRUCT(resource,o)->resource_type=make_shared_string(resource_type); + ERROR_DONE(generic); +} void init_error(void) { diff --git a/src/error.h b/src/error.h index e0280844f110b306e4dc5430278139bab0fd7687..51d43cab98e5f8d6fd68e24b7e871a8f78403cfa 100644 --- a/src/error.h +++ b/src/error.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: error.h,v 1.30 1999/03/19 11:39:09 hubbe Exp $ + * $Id: error.h,v 1.31 1999/03/20 22:24:31 hubbe Exp $ */ #ifndef ERROR_H #define ERROR_H @@ -207,6 +207,16 @@ void bad_arg_error( char *expected_type, struct svalue *got, char *desc, ...) ATTRIBUTE((noreturn,format (printf, 7, 8))); +void math_error( + char *func, + struct svalue *base_sp, int args, + char *desc, ...) ATTRIBUTE((noreturn,format (printf, 4, 5))); +void resource_error( + char *func, + struct svalue *base_sp, int args, + char *resource_type, + long howmuch, + char *desc, ...) ATTRIBUTE((noreturn,format (printf, 6, 7))); void init_error(void); void cleanup_error(void); /* Prototypes end here */ diff --git a/src/errors.h b/src/errors.h index b89e6f32a626f1cf340791e2be5857ab3ae555d5..c4abce4453062856f4da11872be5066393dd88f6 100644 --- a/src/errors.h +++ b/src/errors.h @@ -81,6 +81,16 @@ DECLARE_ERROR(bad_arg, ERR_VAR(struct svalue, mixed, T_MIXED, got) ) +DECLARE_ERROR(math, + ERR_INHERIT(generic), +) + +DECLARE_ERROR(resource, + ERR_INHERIT(generic), + ERR_VAR(struct pike_string *,string,T_STRING,resource_type) + ERR_VAR(INT_TYPE, int, T_INT, howmuch) +) + #undef DECLARE_ERROR #undef ERR_INHERIT #undef ERR_VAR