;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; 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")


#? *** aux_macro

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

#? * (dummy_aux_macro)
#? * (pyobject_delattrstring <o> <a>)
#? * (pyobject_delattr <o> <a>)
#? * (pyobject_typecheck <ob> <tp>)
#? * (pyobject_is_gc <o>)
#? * (pyobject_get_weakrefs_listptr <o>)
#? * (pysequence_fast_get_size <o>)
#? * (pysequence_fast_get_item <o> <i>)
#? * (pymapping_delitemstring <o> <s>)
#? * (pymapping_delitem <o> <k>)
#? * (pymapping_keys <o>)
#? * (pymapping_values <o>)
#? * (pymapping_items <o>)
#? * (pyiter_check <obj>)
#? * (pybuffer_check <op>)
#? * (pytype_hasfeature <s> <f>)
#? * (pytype_supports_weakrefs <s>)
#? * (pytype_check <op>)
#? * (pytype_checkexact <op>)
#? * (pytype_is_gc <s>)
#? * (pyint_check <op>)
#? * (pyint_checkexact <op>)
#? * (pylong_check <op>)
#? * (pylong_checkexact <op>)
#? * (pyfloat_check <op>)
#? * (pyfloat_checkexact <op>)
#? * (pycomplex_check <op>)
#? * (pycomplex_checkexact <op>)
#? * (pystring_check <op>)
#? * (pystring_checkexact <op>)
#? * (pystring_get_size <op>)
#? * (pytuple_check <op>)
#? * (pytuple_checkexact <op>)
#? * (pylist_check <op>)
#? * (pylist_checkexact <op>)
#? * (pydict_check <op>)
#? * (pyfile_check <op>)
#? * (pyfile_checkexact <op>)
#? * (pyinstance_check <op>)
#? * (pymethod_check <op>)
#? * (pymodule_check <op>)
#? * (pymodule_checkexact <op>)
#? * (pyseqiter_check <op>)
#? * (pycalliter_check <op>)
#? * (pyslice_check <op>)
#? * (pyweakref_checkref <op>)
#? * (pyweakref_checkproxy <op>)
#? * (pyweakref_check <op>)
#? * (pycobject_check <op>)
#? * (pycell_check <op>)
#? * (pyclass_check <op>)
#? * (pyfunction_check <op>)
#? * (pyeval_callobject <func> <arg>)
#? * (py_incref <op>)
#? * (py_decref <op>)
#? * (py_xincref <op>)
#? * (py_xdecref <op>)
#? * (pycfunction_check <op>)
#? * (pycfunction_get_function <func>)
#? * (pycfunction_get_self <func>)
#? * (pycfunction_get_flags <func>)
#? * (pyrange_check <op>)
#? * (pytraceback_check <v>)
#? * (py_initmodule <name> <methods>)
#? * (py_initmodule3 <name> <methods> <doc>)

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


(de PyObject_DelAttrString (  O A )
     
    ((-gptr- "PyObject *") O) 
    ((-str-) A)  
     (int   #{ PyObject_DelAttrString( $O ,$A->data ) #} ))

(de PyObject_DelAttr (  O  A  )
     
    ((-gptr- "PyObject *") O) 
    ((-gptr- "PyObject *") A)  
     (int   #{ PyObject_DelAttr(   $O  ,$A ) #} ))

(de PyObject_TypeCheck (  ob   tp  )
     
    ((-gptr- "PyObject *") ob) 
    ((-gptr- "PyTypeObject *")  tp)  
     (int   #{ PyObject_TypeCheck(   $ob  ,$tp ) #} ))


(de PyObject_IS_GC (  o  )
     
    ((-gptr- "PyObject *") o)  
     (gptr   #{ PyObject_IS_GC(   $o ) #} ))



(de PyObject_GET_WEAKREFS_LISTPTR (  o  )
     
    ((-gptr- "PyObject *") o)  
    (gptr   #{ PyObject_GET_WEAKREFS_LISTPTR(   $o ) #} ))







(de PySequence_Fast_GET_SIZE (  o  )
     
    ((-gptr- "PyObject *") o)  
    (int   #{ PySequence_Fast_GET_SIZE(   $o ) #} ))

(de PySequence_Fast_GET_ITEM (  o   i  )
     
    ((-gptr- "PyObject *") o) 
    ((-int-)  i)  
    (gptr   #{ PySequence_Fast_GET_ITEM(   $o  ,$i ) #} ))



(de PyMapping_DelItemString (  O  s  )
     
    ((-gptr- "PyObject *") O) 
    ((-str-) s)  
    #{ PyMapping_DelItemString(   $O  , $s->data ); #} 
    ())

(de PyMapping_DelItem (  O  K  )
     
    ((-gptr- "PyObject *") O) 
    ((-gptr- "PyObject *") K)  
    (int   #{ PyMapping_DelItem(   $O  ,$K ) #} ))

(de PyMapping_Keys (  O  )
     
    ((-gptr- "PyObject *") O)  
     (gptr   #{ PyMapping_Keys(   $O ) #} ))

(de PyMapping_Values (  O  )
     
    ((-gptr- "PyObject *") O)  
     (gptr   #{ PyMapping_Values(   $O ) #} ))

(de PyMapping_Items (  O  )
     
    ((-gptr- "PyObject *") O)  
     (gptr   #{ PyMapping_Items(   $O ) #} ))


(de PyIter_Check (  obj  )
     
    ((-gptr- "PyObject *") obj)  
     (int   #{ PyIter_Check(   $obj ) #} ))



(de PyBuffer_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
     (int   #{ PyBuffer_Check(   $op ) #} ))












(de PyType_HasFeature (  s  f  )
     
    ((-gptr- "PyTypeObject *") s) 
    ((-int-) f)  
    (int   #{ PyType_HasFeature(   $s  ,(long)$f ) #} ))

(de PyType_SUPPORTS_WEAKREFS (  s  )
     
    ((-gptr- "PyTypeObject *") s)  
    (int   #{ PyType_SUPPORTS_WEAKREFS(   $s ) #} ))

(de PyType_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyType_Check(   $op ) #} ))

(de PyType_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int  #{ PyType_CheckExact(   $op ) #} ))


(de PyType_IS_GC (  s  )
     
    ((-gptr- "PyTypeObject *") s)  
    (int  #{ PyType_IS_GC(   $s ) #} ))


(de PyInt_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyInt_Check(   $op ) #} ))

(de PyInt_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int  #{ PyInt_CheckExact(   $op ) #} ))



(de PyLong_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int  #{ PyLong_Check(   $op ) #} ))

(de PyLong_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int  #{ PyLong_CheckExact(   $op ) #} ))



(de PyFloat_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int  #{ PyFloat_Check(   $op ) #} ))

(de PyFloat_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyFloat_CheckExact(   $op ) #} ))



(de PyComplex_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyComplex_Check(   $op ) #} ))

(de PyComplex_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyComplex_CheckExact(   $op ) #} ))


(de PyString_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyString_Check(   $op ) #} ))

(de PyString_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyString_CheckExact(   $op ) #} ))


(de PyString_GET_SIZE (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyString_GET_SIZE(   $op ) #} ))


(de PyTuple_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyTuple_Check(   $op ) #} ))

(de PyTuple_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyTuple_CheckExact(   $op ) #} ))


(de PyList_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyList_Check(   $op ) #} ))

(de PyList_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyList_CheckExact(   $op ) #} ))


(de PyDict_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int  #{ PyDict_Check(   $op ) #} ))


(de PyFile_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyFile_Check(   $op ) #} ))

(de PyFile_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyFile_CheckExact(   $op ) #} ))

(de PyInstance_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyInstance_Check(   $op ) #} ))

(de PyMethod_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyMethod_Check(   $op ) #} ))


(de PyModule_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyModule_Check(   $op ) #} ))

(de PyModule_CheckExact (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyModule_CheckExact(   $op ) #} ))

(de PySeqIter_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PySeqIter_Check(   $op ) #} ))

(de PyCallIter_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyCallIter_Check(   $op ) #} ))


(de PySlice_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PySlice_Check(   $op ) #} ))

(de PyWeakref_CheckRef (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyWeakref_CheckRef(   $op ) #} ))

(de PyWeakref_CheckProxy (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyWeakref_CheckProxy(   $op ) #} ))

(de PyWeakref_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyWeakref_Check(   $op ) #} ))


(de PyCObject_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyCObject_Check(   $op ) #} ))


(de PyCell_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int #{ PyCell_Check(   $op ) #} ))


(de PyClass_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyClass_Check(   $op ) #} ))


(de PyFunction_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyFunction_Check(   $op ) #} ))


(de PyEval_CallObject (  func  arg  )
     
    ((-gptr- "PyObject *") func) 
    ((-gptr- "PyObject *") arg)  
    (gptr   #{ PyEval_CallObject(   $func  ,$arg ) #} ))

(de Py_INCREF (  op  )
     
    ((-gptr- "PyObject *") op)  
    #{ Py_INCREF(   $op ); #} 
    ())

(de Py_DECREF (  op  )
     
    ((-gptr- "PyObject *") op)  
    #{ Py_DECREF(   $op ); #} 
    ())

(de Py_XINCREF (  op  )
     
    ((-gptr- "PyObject *") op)  
    #{ Py_XINCREF(   $op ); #} 
    ())

(de Py_XDECREF (  op  )
     
    ((-gptr- "PyObject *") op)  
    #{ Py_XDECREF(   $op ); #} 
    ())

(de PyCFunction_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyCFunction_Check(   $op ) #} ))

(de PyCFunction_GET_FUNCTION (  func  )
     
    ((-gptr-) func)  
     (gptr   #{ PyCFunction_GET_FUNCTION(   $func ) #} ))

(de PyCFunction_GET_SELF (  func  )
     
    ((-gptr-) func)  
     (gptr   #{ PyCFunction_GET_SELF(   $func ) #} ))

(de PyCFunction_GET_FLAGS (  func  )
     
    ((-gptr-) func)  
    (int   #{ PyCFunction_GET_FLAGS(   $func ) #} ))


(de PyRange_Check (  op  )
     
    ((-gptr- "PyObject *") op)  
    (int   #{ PyRange_Check(   $op ) #} ))

(de PyTraceBack_Check (  v  )
     
    ((-gptr- "PyObject *") v)  
    (int   #{ PyTraceBack_Check(   $v ) #} ))

(de Py_InitModule (  name   methods  )
     
    ((-str-) name) 
    ((-gptr- "PyMethodDef *")  methods)  
    (gptr   #{ Py_InitModule(   $name->data  ,$methods ) #} ))

(de Py_InitModule3 (  name   methods   doc  )
     
    ((-str-) name) 
    ((-gptr- "PyMethodDef *")  methods) 
    ((-str-)  doc)  
     (gptr   #{ Py_InitModule3(   $name->data  ,$methods  ,$doc->data ) #} ))


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

(dhc-make () 
  dummy_aux_macro
  pyobject_delattrstring
  pyobject_delattr
  pyobject_typecheck
  pyobject_is_gc
  pyobject_get_weakrefs_listptr
  pysequence_fast_get_size
  pysequence_fast_get_item
  pymapping_delitemstring
  pymapping_delitem
  pymapping_keys
  pymapping_values
  pymapping_items
  pyiter_check
  pybuffer_check
  pytype_hasfeature
  pytype_supports_weakrefs
  pytype_check
  pytype_checkexact
  pytype_is_gc
  pyint_check
  pyint_checkexact
  pylong_check
  pylong_checkexact
  pyfloat_check
  pyfloat_checkexact
  pycomplex_check
  pycomplex_checkexact
  pystring_check
  pystring_checkexact
  pystring_get_size
  pytuple_check
  pytuple_checkexact
  pylist_check
  pylist_checkexact
  pydict_check
  pyfile_check
  pyfile_checkexact
  pyinstance_check
  pymethod_check
  pymodule_check
  pymodule_checkexact
  pyseqiter_check
  pycalliter_check
  pyslice_check
  pyweakref_checkref
  pyweakref_checkproxy
  pyweakref_check
  pycobject_check
  pycell_check
  pyclass_check
  pyfunction_check
  pyeval_callobject
  py_incref
  py_decref
  py_xincref
  py_xdecref
  pycfunction_check
  pycfunction_get_function
  pycfunction_get_self
  pycfunction_get_flags
  pyrange_check
  pytraceback_check
  py_initmodule
  py_initmodule3
)
