;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; LUSH Lisp Universal Shell
;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
;;; Includes parts of TL3:
;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
;;; Includes selected parts of SN3.2:
;;;   Copyright (C) 1991-2001 AT&T Corp.
;;;
;;; Includes information derived from the GSL (Gnu Scientific Library)
;;;   header files which are copyrighted and distributed under the GPL
;;;   by their respective authors.
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(libload "python/python-config")


#? *** pyerr

;; dummy function that adds Python C header files in C file
(eval `(de dummy_pyerr () ,python-cpheader-cmd ()))

#? * (dummy_pyerr)
#? * (pyerr_setnone <om>)
#? * (pyerr_setobject <o1> <om>)
#? * (pyerr_setstring <o1> <om>)
#? * (pyerr_occurred)
#? * (pyerr_clear)
#? * (pyerr_fetch <o1> <o2> <om>)
#? * (pyerr_restore <o1> <o2> <om>)
#? * (pyerr_givenexceptionmatches <o1> <om>)
#? * (pyerr_exceptionmatches <om>)
#? * (pyerr_normalizeexception <o1> <o2> <om>)
#? * (pyerr_badargument)
#? * (pyerr_nomemory)
#? * (pyerr_setfromerrno <om>)
#? * (pyerr_setfromerrnowithfilename <o1> <om>)
#? * (pyerr_badinternalcall)
#? * (_pyerr_badinternalcall <filename> <lineno>)
#? * (pyerr_writeunraisable <om>)
#? * (pyerr_warn <o1> <om>)
#? * (pyerr_warnexplicit <o1> <o2> <s> <p> <m> <om>)
#? * (pyerr_checksignals)
#? * (pyerr_setinterrupt)
#? * (pyerr_syntaxlocation <o1> <im>)
#? * (pyerr_programtext <o1> <im>)
#? * (pyerr_print)
#? * (pyerr_printex <im>)
#? * (pyerr_display <o1> <o2> <om>)
#? * (pyerr_newexception <name> <base> <dict>)

;; ********************************************************

(de PyErr_SetNone ( om )
    ((-gptr-"PyObject *") om)   
    #{  PyErr_SetNone( $om );  #} 
    ())

(de PyErr_SetObject ( o1  om )
    ((-gptr-"PyObject *") o1)  
    ((-gptr-"PyObject *") om)   
    #{  PyErr_SetObject( $o1   ,$om );  #} 
    ())

(de PyErr_SetString ( o1  om )
    ((-gptr-"PyObject *") o1)  
    ((-str-) om)   
    #{  PyErr_SetString( $o1 ,(const char *)$om->data );  #} 
    ())

(de PyErr_Occurred ()
    (gptr  #{  PyErr_Occurred(  )  #} ))        ;; PyObject * -> gptr

(de PyErr_Clear ()
    #{ PyErr_Clear(  );  #} 
    ())

(de PyErr_Fetch ( o1  o2  om )
    ((-gptr-"PyObject **") o1)  
    ((-gptr-"PyObject **") o2)  
    ((-gptr-"PyObject **") om)   
    #{  PyErr_Fetch( $o1   ,$o2   ,$om );  #} 
    ())

(de PyErr_Restore ( o1  o2  om )
    ((-gptr-"PyObject *") o1)  
    ((-gptr-"PyObject *") o2)  
    ((-gptr-"PyObject *") om)   
    #{  PyErr_Restore( $o1   ,$o2   ,$om );  #} 
    ())

(de PyErr_GivenExceptionMatches ( o1  om )
    ((-gptr-"PyObject *") o1)  
    ((-gptr-"PyObject *") om)   
    (int  #{  PyErr_GivenExceptionMatches( $o1   ,$om )  #} ))

(de PyErr_ExceptionMatches ( om )
    ((-gptr-"PyObject *") om)   
    (int  #{  PyErr_ExceptionMatches( $om )  #} ))

(de PyErr_NormalizeException ( o1  o2  om )
    ((-gptr- "PyObject**") o1)  
    ((-gptr- "PyObject**") o2)  
    ((-gptr- "PyObject**") om)   
    #{  PyErr_NormalizeException( $o1 ,$o2 ,$om );  #} 
    ())

(de PyErr_BadArgument ()
    (int  #{  PyErr_BadArgument(  )  #} ))

(de PyErr_NoMemory ()
    (gptr  #{  PyErr_NoMemory(  )  #} ))        ;; PyObject * -> gptr

(de PyErr_SetFromErrno ( om )
    ((-gptr-"PyObject *") om)   
    (gptr  #{  PyErr_SetFromErrno( $om )  #} ))        ;; PyObject * -> gptr

(de PyErr_SetFromErrnoWithFilename ( o1  om )
    ((-gptr-"PyObject *") o1)  
    ((-str-) om)   
    (gptr  #{  PyErr_SetFromErrnoWithFilename( $o1 ,$om->data )  #} ))        ;; PyObject * -> gptr

(de PyErr_BadInternalCall ()
    #{ PyErr_BadInternalCall(); #} 
    ())

(de _PyErr_BadInternalCall ( filename  lineno )
    ((-str-) filename)  
    ((-int-) lineno)   
    #{ _PyErr_BadInternalCall( $filename->data   ,$lineno );  #} 
    ())

(de PyErr_WriteUnraisable ( om )
    ((-gptr-"PyObject *") om)   
    #{  PyErr_WriteUnraisable( $om );  #} 
    ())

(de PyErr_Warn ( o1  om )
    ((-gptr-"PyObject *") o1)  
    ((-str-) om)   
    (int  #{  PyErr_Warn( $o1 ,$om->data )  #} ))

(de PyErr_WarnExplicit ( o1  o2  s  p  m  om )
    ((-gptr-"PyObject *") o1)  
    ((-str-) o2)  
    ((-str-) s)  
    ((-int-) p)  
    ((-str-) m)  
    ((-gptr-"PyObject *") om)   
    (int  #{  PyErr_WarnExplicit( $o1 ,$o2->data ,$s->data ,$p ,$m->data ,$om )  #} ))

(de PyErr_CheckSignals ()
    (int  #{  PyErr_CheckSignals(  )  #} ))

(de PyErr_SetInterrupt ()
    #{ PyErr_SetInterrupt( );  #} 
    ())

(de PyErr_SyntaxLocation ( o1  im )
    ((-str-) o1)  
    ((-int-) im)   
    #{  PyErr_SyntaxLocation( $o1->data ,$im );  #} 
    ())

(de PyErr_ProgramText ( o1  im )
    ((-str-) o1)  
    ((-int-) im)   
    (gptr  #{  PyErr_ProgramText( $o1->data ,$im )  #} ))        ;; PyObject * -> gptr

(de PyErr_Print ()
    #{ PyErr_Print( );  #} 
    ())

(de PyErr_PrintEx ( im )
    ((-int-) im)   
    #{  PyErr_PrintEx( $im );  #} 
    ())

(de PyErr_Display ( o1  o2  om )
    ((-gptr-"PyObject *") o1)  
    ((-gptr-"PyObject *") o2)  
    ((-gptr-"PyObject *") om)   
    #{  PyErr_Display( $o1   ,$o2   ,$om );  #} 
    ())

(de PyErr_NewException (name  base  dict )
    ((-str-) name)  
    ((-gptr-"PyObject *") base)  
    ((-gptr-"PyObject *") dict)   
    (gptr  #{  PyErr_NewException($name->data ,$base   ,$dict )  #} ))        ;; PyObject * -> gptr

()
;; ********************************************************

(dhc-make ()
  dummy_pyerr
  pyerr_setnone
  pyerr_setobject
  pyerr_setstring
  pyerr_occurred
  pyerr_clear
  pyerr_fetch
  pyerr_restore
  pyerr_givenexceptionmatches
  pyerr_exceptionmatches
  pyerr_normalizeexception
  pyerr_badargument
  pyerr_nomemory
  pyerr_setfromerrno
  pyerr_setfromerrnowithfilename
  pyerr_badinternalcall
  _pyerr_badinternalcall
  pyerr_writeunraisable
  pyerr_warn
  pyerr_warnexplicit
  pyerr_checksignals
  pyerr_setinterrupt
  pyerr_syntaxlocation
  pyerr_programtext
  pyerr_print
  pyerr_printex
  pyerr_display
  pyerr_newexception
)
