home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activepython / ActivePython-2.1.1.msi / Python21_include_pyerrors.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-26  |  4.3 KB  |  113 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. /* Predefined warning categories */
  64. extern DL_IMPORT(PyObject *) PyExc_Warning;
  65. extern DL_IMPORT(PyObject *) PyExc_UserWarning;
  66. extern DL_IMPORT(PyObject *) PyExc_DeprecationWarning;
  67. extern DL_IMPORT(PyObject *) PyExc_SyntaxWarning;
  68. extern DL_IMPORT(PyObject *) PyExc_RuntimeWarning;
  69.  
  70.  
  71. /* Convenience functions */
  72.  
  73. extern DL_IMPORT(int) PyErr_BadArgument(void);
  74. extern DL_IMPORT(PyObject *) PyErr_NoMemory(void);
  75. extern DL_IMPORT(PyObject *) PyErr_SetFromErrno(PyObject *);
  76. extern DL_IMPORT(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *);
  77. extern DL_IMPORT(PyObject *) PyErr_Format(PyObject *, const char *, ...);
  78. #ifdef MS_WINDOWS
  79. extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *);
  80. extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErr(int);
  81. #endif
  82.  
  83. /* Export the old function so that the existing API remains available: */
  84. extern DL_IMPORT(void) PyErr_BadInternalCall(void);
  85. extern DL_IMPORT(void) _PyErr_BadInternalCall(char *filename, int lineno);
  86. /* Mask the old API with a call to the new API for code compiled under
  87.    Python 2.0: */
  88. #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
  89.  
  90. /* Function to create a new exception */
  91. DL_IMPORT(PyObject *) PyErr_NewException(char *name, PyObject *base,
  92.                                          PyObject *dict);
  93. extern DL_IMPORT(void) PyErr_WriteUnraisable(PyObject *);
  94.  
  95. /* Issue a warning or exception */
  96. extern DL_IMPORT(int) PyErr_Warn(PyObject *, char *);
  97. extern DL_IMPORT(int) PyErr_WarnExplicit(PyObject *, char *,
  98.                      char *, int, char *, PyObject *);
  99.  
  100. /* In sigcheck.c or signalmodule.c */
  101. extern DL_IMPORT(int) PyErr_CheckSignals(void);
  102. extern DL_IMPORT(void) PyErr_SetInterrupt(void);
  103.  
  104. /* Support for adding program text to SyntaxErrors */
  105. extern DL_IMPORT(void) PyErr_SyntaxLocation(char *, int);
  106. extern DL_IMPORT(PyObject *) PyErr_ProgramText(char *, int);
  107.     
  108.  
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112. #endif /* !Py_ERRORS_H */
  113.