home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 April / PCWorld_2001-04_cd.bin / Software / TemaCD / webclean / !!!python!!! / BeOpen-Python-2.0.exe / PYERRORS.H < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-01  |  3.7 KB  |  97 lines

  1. #ifndef Py_ERRORS_H
  2. #define Py_ERRORS_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6.  
  7.  
  8. /* Error handling definitions */
  9.  
  10. DL_IMPORT(void) PyErr_SetNone(PyObject *);
  11. DL_IMPORT(void) PyErr_SetObject(PyObject *, PyObject *);
  12. DL_IMPORT(void) PyErr_SetString(PyObject *, const char *);
  13. DL_IMPORT(PyObject *) PyErr_Occurred(void);
  14. DL_IMPORT(void) PyErr_Clear(void);
  15. DL_IMPORT(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);
  16. DL_IMPORT(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);
  17.  
  18. /* Error testing and normalization */
  19. DL_IMPORT(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);
  20. DL_IMPORT(int) PyErr_ExceptionMatches(PyObject *);
  21. DL_IMPORT(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
  22.  
  23.  
  24. /* Predefined exceptions */
  25.  
  26. extern DL_IMPORT(PyObject *) PyExc_Exception;
  27. extern DL_IMPORT(PyObject *) PyExc_StandardError;
  28. extern DL_IMPORT(PyObject *) PyExc_ArithmeticError;
  29. extern DL_IMPORT(PyObject *) PyExc_LookupError;
  30.  
  31. extern DL_IMPORT(PyObject *) PyExc_AssertionError;
  32. extern DL_IMPORT(PyObject *) PyExc_AttributeError;
  33. extern DL_IMPORT(PyObject *) PyExc_EOFError;
  34. extern DL_IMPORT(PyObject *) PyExc_FloatingPointError;
  35. extern DL_IMPORT(PyObject *) PyExc_EnvironmentError;
  36. extern DL_IMPORT(PyObject *) PyExc_IOError;
  37. extern DL_IMPORT(PyObject *) PyExc_OSError;
  38. extern DL_IMPORT(PyObject *) PyExc_ImportError;
  39. extern DL_IMPORT(PyObject *) PyExc_IndexError;
  40. extern DL_IMPORT(PyObject *) PyExc_KeyError;
  41. extern DL_IMPORT(PyObject *) PyExc_KeyboardInterrupt;
  42. extern DL_IMPORT(PyObject *) PyExc_MemoryError;
  43. extern DL_IMPORT(PyObject *) PyExc_NameError;
  44. extern DL_IMPORT(PyObject *) PyExc_OverflowError;
  45. extern DL_IMPORT(PyObject *) PyExc_RuntimeError;
  46. extern DL_IMPORT(PyObject *) PyExc_NotImplementedError;
  47. extern DL_IMPORT(PyObject *) PyExc_SyntaxError;
  48. extern DL_IMPORT(PyObject *) PyExc_IndentationError;
  49. extern DL_IMPORT(PyObject *) PyExc_TabError;
  50. extern DL_IMPORT(PyObject *) PyExc_SystemError;
  51. extern DL_IMPORT(PyObject *) PyExc_SystemExit;
  52. extern DL_IMPORT(PyObject *) PyExc_TypeError;
  53. extern DL_IMPORT(PyObject *) PyExc_UnboundLocalError;
  54. extern DL_IMPORT(PyObject *) PyExc_UnicodeError;
  55. extern DL_IMPORT(PyObject *) PyExc_ValueError;
  56. extern DL_IMPORT(PyObject *) PyExc_ZeroDivisionError;
  57. #ifdef MS_WINDOWS
  58. extern DL_IMPORT(PyObject *) PyExc_WindowsError;
  59. #endif
  60.  
  61. extern DL_IMPORT(PyObject *) PyExc_MemoryErrorInst;
  62.  
  63.  
  64. /* Convenience functions */
  65.  
  66. extern DL_IMPORT(int) PyErr_BadArgument(void);
  67. extern DL_IMPORT(PyObject *) PyErr_NoMemory(void);
  68. extern DL_IMPORT(PyObject *) PyErr_SetFromErrno(PyObject *);
  69. extern DL_IMPORT(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *);
  70. extern DL_IMPORT(PyObject *) PyErr_Format(PyObject *, const char *, ...);
  71. #ifdef MS_WINDOWS
  72. extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *);
  73. extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErr(int);
  74. #endif
  75.  
  76. /* Export the old function so that the existing API remains available: */
  77. extern DL_IMPORT(void) PyErr_BadInternalCall(void);
  78. extern DL_IMPORT(void) _PyErr_BadInternalCall(char *filename, int lineno);
  79. /* Mask the old API with a call to the new API for code compiled under
  80.    Python 2.0: */
  81. #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
  82.  
  83. /* Function to create a new exception */
  84. DL_IMPORT(PyObject *) PyErr_NewException(char *name, PyObject *base,
  85.                                          PyObject *dict);
  86. extern DL_IMPORT(void) PyErr_WriteUnraisable(PyObject *);
  87.  
  88. /* In sigcheck.c or signalmodule.c */
  89. extern DL_IMPORT(int) PyErr_CheckSignals(void);
  90. extern DL_IMPORT(void) PyErr_SetInterrupt(void);
  91.     
  92.  
  93. #ifdef __cplusplus
  94. }
  95. #endif
  96. #endif /* !Py_ERRORS_H */
  97.