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


#? *** pyobject

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

#? * (dummy_pyobject)
#? * (pyobject_cmp <o1> <o2> <result>)
#? * (pyobject_call <callable_object> <args> <kw>)
#? * (pyobject_callobject <callable_object> <args>)
#? * (pyobject_type <o>)
#? * (pyobject_size <o>)
#? * (pyobject_length <o>)
#? * (pyobject_getitem <o> <key>)
#? * (pyobject_setitem <o> <key> <v>)
#? * (pyobject_delitem <o> <key>)
#? * (pyobject_delitemstring <o> <k>)
#? * (pyobject_ascharbuffer <obj> <buffer> <buffer_len>)
#? * (pyobject_checkreadbuffer <obj>)
#? * (pyobject_asreadbuffer <obj> <buffer> <buffer_len>)
#? * (pyobject_aswritebuffer <obj> <buffer> <buffer_len>)
#? * (pyobject_getiter <s>)
#? * (pyobject_print <o> <f> <m>)
#? * (_pyobject_dump <o>)
#? * (pyobject_repr <o>)
#? * (pyobject_str <o>)
#? * (pyobject_unicode <o>)
#? * (pyobject_compare <o1> <om>)
#? * (pyobject_richcompare <o1> <o2> <im>)
#? * (pyobject_richcomparebool <o1> <o2> <im>)
#? * (pyobject_getattrstring <o1> <om>)
#? * (pyobject_setattrstring <o1> <o2> <om>)
#? * (pyobject_hasattrstring <o1> <om>)
#? * (pyobject_getattr <o1> <om>)
#? * (pyobject_setattr <o1> <o2> <om>)
#? * (pyobject_hasattr <o1> <om>)
#? * (_pyobject_getdictptr <om>)
#? * (pyobject_genericgetattr <o1> <om>)
#? * (pyobject_genericsetattr <o1> <o2> <om>)
#? * (pyobject_hash <om>)
#? * (pyobject_istrue <om>)
#? * (pyobject_not <om>)
#? * (pyobject_malloc <s>)
#? * (pyobject_realloc <o1> <s>)
#? * (pyobject_free <om>)
#? * (pyobject_init <o1> <om>)
#? * (pyobject_initvar <o1> <o2> <im>)
#? * (_pyobject_new <om>)
#? * (_pyobject_newvar <o1> <im>)
#? * (_pyobject_del <om>)
#? * (_pyobject_gc_malloc <o1> <im>)
#? * (_pyobject_gc_resize <o1> <im>)
#? * (_pyobject_gc_new <om>)
#? * (_pyobject_gc_newvar <o1> <im>)
#? * (_pyobject_gc_del <om>)
#? * (_pyobject_gc_track <om>)
#? * (_pyobject_gc_untrack <om>)
#? * (pyobject_isinstance <object> <typeorclass>)
#? * (pyobject_issubclass <object> <typeorclass>)
#? * (pyobject_asfiledescriptor <om>)
#? * (pyobject_clearweakrefs <om>)
#? * (pyobject_dir <om>)
#? * (_pyobject_slotcompare <o1> <om>)

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


(de PyObject_Cmp ( o1  o2  result )
    ((-gptr-"PyObject *") o1)  
    ((-gptr-"PyObject *") o2)  
    ((-gptr-"int *") result)   
    (int  #{  PyObject_Cmp( $o1   ,$o2   ,$result )  #} ))

(de PyObject_Call ( callable_object  args  kw )
    ((-gptr-"PyObject *") callable_object)  
    ((-gptr-"PyObject *") args)  
    ((-gptr-"PyObject *") kw)   
    (gptr  #{  PyObject_Call( $callable_object   ,$args   ,$kw )  #} ))        ;; PyObject * -> gptr

(de PyObject_CallObject ( callable_object  args )
    ((-gptr-"PyObject *") callable_object)  
    ((-gptr-"PyObject *") args)   
    (gptr  #{  PyObject_CallObject( $callable_object   ,$args )  #} ))        ;; PyObject * -> gptr

(de PyObject_Type ( o )
    ((-gptr-"PyObject *") o)   
    (gptr  #{  PyObject_Type( $o )  #} ))        ;; PyObject * -> gptr

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

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

(de PyObject_GetItem ( o  key )
    ((-gptr-"PyObject *") o)  
    ((-gptr-"PyObject *") key)   
    (gptr  #{  PyObject_GetItem( $o   ,$key )  #} ))        ;; PyObject * -> gptr

(de PyObject_SetItem ( o  key  v )
    ((-gptr-"PyObject *") o)  
    ((-gptr-"PyObject *") key)  
    ((-gptr-"PyObject *") v)   
    (int  #{  PyObject_SetItem( $o   ,$key   ,$v )  #} ))

(de PyObject_DelItem ( o  key )
    ((-gptr-"PyObject *") o)  
    ((-gptr-"PyObject *") key)   
    (int  #{  PyObject_DelItem( $o   ,$key )  #} ))

(de PyObject_DelItemString (o k)
    ((-gptr- "PyObject *") o)
    ((-str-) k)
    #{ PyObject_DelItem($o, $k->data); #}
    ())

(de PyObject_AsCharBuffer ( obj  buffer  buffer_len )
    ((-gptr-"PyObject *") obj)  
    ((-gptr-"const char **") buffer)  
    ((-gptr-"int *") buffer_len)   
    (int  #{  PyObject_AsCharBuffer( $obj   ,$buffer   ,$buffer_len )  #} ))

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

(de PyObject_AsReadBuffer ( obj  buffer  buffer_len )
    ((-gptr-"PyObject *") obj)  
    ((-gptr-"const void **") buffer)  
    ((-gptr-"int *") buffer_len)   
    (int  #{  PyObject_AsReadBuffer( $obj   ,$buffer   ,$buffer_len )  #} ))

(de PyObject_AsWriteBuffer ( obj  buffer  buffer_len )
    ((-gptr-"PyObject *") obj)  
    ((-gptr-"void **") buffer)  
    ((-gptr-"int *") buffer_len)   
    (int  #{  PyObject_AsWriteBuffer( $obj   ,$buffer   ,$buffer_len )  #} ))

(de PyObject_GetIter ( s )
    ((-gptr-"PyObject *") s)   
    (gptr  #{  PyObject_GetIter( $s )  #} ))        ;; PyObject * -> gptr

(de PyObject_Print ( o  f  m )
    ((-gptr-"PyObject *") o)  
    ((-gptr-"FILE *") f)  
    ((-int-) m)   
    (int  #{  PyObject_Print( $o   ,$f   ,$m )  #} ))

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

(de PyObject_Repr ( o )
    ((-gptr-"PyObject *") o)   
    (gptr  #{  PyObject_Repr( $o )  #} ))        ;; PyObject * -> gptr

(de PyObject_Str ( o )
    ((-gptr-"PyObject *") o)   
    (gptr  #{  PyObject_Str( $o )  #} ))        ;; PyObject * -> gptr

(de PyObject_Unicode ( o )
    ((-gptr-"PyObject *") o)   
    (gptr  #{  PyObject_Unicode( $o )  #} ))        ;; PyObject * -> gptr

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

(de PyObject_RichCompare ( o1  o2  im )
    ((-gptr-"PyObject *") o1)  
    ((-gptr-"PyObject *") o2)  
    ((-int-) im)   
    (gptr  #{  PyObject_RichCompare( $o1   ,$o2   ,$im )  #} ))        ;; PyObject * -> gptr

(de PyObject_RichCompareBool ( o1  o2  im )
    ((-gptr-"PyObject *") o1)  
    ((-gptr-"PyObject *") o2)  
    ((-int-) im)   
    (int  #{  PyObject_RichCompareBool( $o1   ,$o2   ,$im )  #} ))

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

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

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

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

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

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

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

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

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

(de PyObject_Hash ( om )
    ((-gptr-"PyObject *") om)   
    (int  #{  PyObject_Hash( $om )  #} ))             ;; long -> int

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

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

(de PyObject_Malloc ( s )
    ((-int-) s)    ;; size_t -> int
    (gptr  #{  PyObject_Malloc( $s )  #} ))         ;; void * -> gptr

(de PyObject_Realloc ( o1  s )
    ((-gptr-"void *") o1)  
    ((-int-) s)    ;; size_t -> int
    (gptr  #{  PyObject_Realloc( $o1   ,$s )  #} ))         ;; void * -> gptr

(de PyObject_Free ( om )
    ((-gptr-"void *") om)   
    #{  PyObject_Free( $om );  #} 
    ())

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

(de PyObject_InitVar ( o1  o2  im )
    ((-gptr-"PyVarObject *") o1)  
    ((-gptr-"PyTypeObject *") o2)  
    ((-int-) im)   
    (gptr  #{  PyObject_InitVar( $o1   ,$o2   ,$im )  #} ))         ;; PyVarObject * -> gptr

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

(de _PyObject_NewVar ( o1  im )
    ((-gptr-"PyTypeObject *") o1)  
    ((-int-) im)   
    (gptr  #{ _PyObject_NewVar( $o1   ,$im )  #} ))   ;; PyVarObject * -> gptr

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

(de _PyObject_GC_Malloc ( o1  im )
    ((-gptr-"PyTypeObject *") o1)  
    ((-int-) im)   
    (gptr  #{ _PyObject_GC_Malloc( $o1   ,$im )  #} ))        ;; PyObject * -> gptr

(de _PyObject_GC_Resize ( o1  im )
    ((-gptr-"PyVarObject *") o1)  
    ((-int-) im)   
    (gptr  #{ _PyObject_GC_Resize( $o1   ,$im )  #} ))   ;; PyVarObject * -> gptr

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

(de _PyObject_GC_NewVar ( o1  im )
    ((-gptr-"PyTypeObject *") o1)  
    ((-int-) im)   
    (gptr  #{ _PyObject_GC_NewVar( $o1   ,$im )  #} ))   ;; PyVarObject * -> gptr

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

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

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



(de PyObject_IsInstance ( object  typeorclass )
    ((-gptr-"PyObject *") object)  
    ((-gptr-"PyObject *") typeorclass)   
    (int  #{  PyObject_IsInstance( $object   ,$typeorclass )  #} ))

(de PyObject_IsSubclass ( object  typeorclass )
    ((-gptr-"PyObject *") object)  
    ((-gptr-"PyObject *") typeorclass)   
    (int  #{  PyObject_IsSubclass( $object   ,$typeorclass )  #} ))


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

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

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

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

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

(dhc-make () 
  dummy_pyobject
  pyobject_cmp
  pyobject_call
  pyobject_callobject
  pyobject_type
  pyobject_size
  pyobject_length
  pyobject_getitem
  pyobject_setitem
  pyobject_delitem
  pyobject_delitemstring
  pyobject_ascharbuffer
  pyobject_checkreadbuffer
  pyobject_asreadbuffer
  pyobject_aswritebuffer
  pyobject_getiter
  pyobject_print
  _pyobject_dump
  pyobject_repr
  pyobject_str
  pyobject_unicode
  pyobject_compare
  pyobject_richcompare
  pyobject_richcomparebool
  pyobject_getattrstring
  pyobject_setattrstring
  pyobject_hasattrstring
  pyobject_getattr
  pyobject_setattr
  pyobject_hasattr
  _pyobject_getdictptr
  pyobject_genericgetattr
  pyobject_genericsetattr
  pyobject_hash
  pyobject_istrue
  pyobject_not
  pyobject_malloc
  pyobject_realloc
  pyobject_free
  pyobject_init
  pyobject_initvar
  _pyobject_new
  _pyobject_newvar
  _pyobject_del
  _pyobject_gc_malloc
  _pyobject_gc_resize
  _pyobject_gc_new
  _pyobject_gc_newvar
  _pyobject_gc_del
  _pyobject_gc_track
  _pyobject_gc_untrack
  pyobject_isinstance
  pyobject_issubclass
  pyobject_asfiledescriptor
  pyobject_clearweakrefs
  pyobject_dir
  _pyobject_slotcompare
)
