error.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* classes: h_files */
  2. #ifndef SCM_ERROR_H
  3. #define SCM_ERROR_H
  4. /* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2006, 2008, 2011, 2014 Free Software Foundation, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation; either version 3 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19. * 02110-1301 USA
  20. */
  21. #include "libguile/__scm.h"
  22. SCM_API SCM scm_system_error_key;
  23. SCM_API SCM scm_num_overflow_key;
  24. SCM_API SCM scm_out_of_range_key;
  25. SCM_API SCM scm_args_number_key;
  26. SCM_API SCM scm_arg_type_key;
  27. SCM_API SCM scm_misc_error_key;
  28. #define SCM_ASSERT(_cond, _arg, _pos, _subr) \
  29. do { if (SCM_UNLIKELY (!(_cond))) \
  30. scm_wrong_type_arg (_subr, _pos, _arg); } while (0)
  31. #define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg) \
  32. do { if (SCM_UNLIKELY (!(_cond))) \
  33. scm_wrong_type_arg_msg(_subr, _pos, _arg, _msg); } while (0)
  34. SCM_API void scm_error (SCM key, const char *subr, const char *message,
  35. SCM args, SCM rest) SCM_NORETURN;
  36. SCM_API SCM scm_error_scm (SCM key, SCM subr, SCM message,
  37. SCM args, SCM rest) SCM_NORETURN;
  38. SCM_API SCM scm_strerror (SCM err);
  39. SCM_API void scm_syserror (const char *subr) SCM_NORETURN;
  40. SCM_API void scm_syserror_msg (const char *subr, const char *message,
  41. SCM args, int eno) SCM_NORETURN;
  42. SCM_API void scm_num_overflow (const char *subr) SCM_NORETURN;
  43. SCM_API void scm_out_of_range (const char *subr, SCM bad_value)
  44. SCM_NORETURN;
  45. SCM_API void scm_out_of_range_pos (const char *subr, SCM bad_value, SCM pos)
  46. SCM_NORETURN;
  47. SCM_API void scm_wrong_num_args (SCM proc) SCM_NORETURN;
  48. SCM_API void scm_error_num_args_subr (const char* subr) SCM_NORETURN;
  49. SCM_API void scm_wrong_type_arg (const char *subr, int pos,
  50. SCM bad_value) SCM_NORETURN;
  51. SCM_INTERNAL void scm_i_wrong_type_arg_symbol (SCM symbol, int pos,
  52. SCM bad_value) SCM_NORETURN;
  53. SCM_API void scm_wrong_type_arg_msg (const char *subr, int pos,
  54. SCM bad_value, const char *sz) SCM_NORETURN;
  55. SCM_API void scm_misc_error (const char *subr, const char *message,
  56. SCM args) SCM_NORETURN;
  57. SCM_INTERNAL void scm_init_error (void);
  58. #endif /* SCM_ERROR_H */
  59. /*
  60. Local Variables:
  61. c-file-style: "gnu"
  62. End:
  63. */