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


#? *** pyothers

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

#? * (dummy_pyothers)
#? * (pydescr_newmethod <o1> <om>)
#? * (pydescr_newmember <o1> <om>)
#? * (pydescr_newgetset <o1> <om>)
#? * (pydescr_newwrapper <o1> <o2> <om>)
#? * (pydescr_isdata <om>)
#? * (pydictproxy_new <om>)
#? * (pywrapper_new <o1> <om>)
#? * (pyiter_next <om>)
#? * (pyseqiter_new <om>)
#? * (pycalliter_new <o1> <om>)
#? * (pycfunction_getfunction <om>)
#? * (pycfunction_getself <om>)
#? * (pycfunction_getflags <om>)
#? * (pycfunction_new <o1> <om>)
#? * (_pytrash_deposit_object <om>)
#? * (_pytrash_destroy_chain)
#? * (pythreadstate_next <om>)
#? * (_pybuiltin_init)
#? * (_pyimport_init)
#? * (_pyimport_fini)
#? * (_pyexc_init)
#? * (_pyexc_fini)
#? * (pymethod_fini)
#? * (pyframe_fini)
#? * (pycfunction_fini)
#? * (pyrange_new <s> <p> <m> <im>)
#? * (pyslice_new <start> <stop> <step>)
#? * (pyslice_getindices <r> <length> <start> <stop> <step>)

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


(de PyDescr_NewMethod ( o1  om )
    ((-gptr-"PyTypeObject *") o1)  
    ((-gptr-"PyMethodDef *") om)   
    (gptr  #{  PyDescr_NewMethod( $o1   ,$om )  #} ))        ;; PyObject * -> gptr

(de PyDescr_NewMember ( o1  om )
    ((-gptr-"PyTypeObject *") o1)  
    ((-gptr-"struct PyMemberDef *") om)   
    (gptr  #{  PyDescr_NewMember( $o1   ,$om )  #} ))        ;; PyObject * -> gptr

(de PyDescr_NewGetSet ( o1  om )
    ((-gptr-"PyTypeObject *") o1)  
    ((-gptr-"struct PyGetSetDef *") om)   
    (gptr  #{  PyDescr_NewGetSet( $o1   ,$om )  #} ))        ;; PyObject * -> gptr

(de PyDescr_NewWrapper ( o1  o2  om )
    ((-gptr-"PyTypeObject *") o1)  
    ((-gptr-"struct wrapperbase *") o2)  
    ((-gptr-) om)   
    (gptr  #{  PyDescr_NewWrapper( $o1   ,$o2   ,$om )  #} ))        ;; PyObject * -> gptr

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

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

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



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


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

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

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

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

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

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

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

(de _PyTrash_destroy_chain ()
    #{ _PyTrash_destroy_chain(  );  #} 
    ())


(de PyThreadState_Next ( om )
    ((-gptr-"PyThreadState *") om)   
    (gptr  #{  PyThreadState_Next( $om )  #} ))   ;; PyThreadState * -> gptr

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


(de _PyImport_Init ()
    #{ _PyImport_Init(  );  #} 
    ())

(de _PyImport_Fini ()
    #{ _PyImport_Fini(  );  #} 
    ())

(de _PyExc_Init ()
    #{ _PyExc_Init(  );  #} 
    ())

(de _PyExc_Fini ()
    #{ _PyExc_Fini(  );  #} 
    ())


(de PyMethod_Fini ()
    #{ PyMethod_Fini(  );  #} 
    ())

(de PyFrame_Fini ()
    #{ PyFrame_Fini(  );  #} 
    ())

(de PyCFunction_Fini ()
    #{ PyCFunction_Fini(  );  #} 
    ())

(de PyRange_New ( s  p  m  im )
    ((-int-) s)           ;; long -> int
    ((-int-) p)           ;; long -> int
    ((-int-) m)           ;; long -> int
    ((-int-) im)   
    (gptr  #{  PyRange_New((long)$s, (long)$p, (long)$m   ,$im )  #} ))        ;; PyObject * -> gptr

(de PySlice_New ( start  stop  step )
    ((-gptr-"PyObject*") start)  
    ((-gptr-"PyObject*") stop)  
    ((-gptr-"PyObject*") step)   
    (gptr  #{  PySlice_New( $start   ,$stop   ,$step )  #} ))        ;; PyObject * -> gptr

(de PySlice_GetIndices ( r  length  start  stop  step )
    ((-gptr-"PySliceObject *") r)  
    ((-int-) length)  
    ((-gptr-"int *") start)  
    ((-gptr-"int *") stop)  
    ((-gptr-"int *") step)   
    (int  #{  PySlice_GetIndices( $r   ,$length   ,$start   ,$stop   ,$step )  #} ))


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

(dhc-make () 
  dummy_pyothers
  pydescr_newmethod
  pydescr_newmember
  pydescr_newgetset
  pydescr_newwrapper
  pydescr_isdata
  pydictproxy_new
  pywrapper_new
  pyiter_next
  pyseqiter_new
  pycalliter_new
  pycfunction_getfunction
  pycfunction_getself
  pycfunction_getflags
  pycfunction_new
  _pytrash_deposit_object
  _pytrash_destroy_chain
  pythreadstate_next
  _pybuiltin_init
  _pyimport_init
  _pyimport_fini
  _pyexc_init
  _pyexc_fini
  pymethod_fini
  pyframe_fini
  pycfunction_fini
  pyrange_new
  pyslice_new
  pyslice_getindices
)
