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


#? *** pyeval

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

#? * (dummy_pyeval)
#? * (pyeval_callobjectwithkeywords <o1> <o2> <om>)
#? * (pyeval_setprofile <f> <om>)
#? * (pyeval_settrace <f> <om>)
#? * (pyeval_getbuiltins)
#? * (pyeval_getglobals)
#? * (pyeval_getlocals)
#? * (pyeval_getowner)
#? * (pyeval_getframe)
#? * (pyeval_getrestricted)
#? * (pyeval_mergecompilerflags <cf>)
#? * (pyeval_getfuncname <om>)
#? * (pyeval_getfuncdesc <om>)
#? * (pyeval_savethread)
#? * (pyeval_restorethread <om>)
#? * (pyeval_initthreads)
#? * (pyeval_acquirelock)
#? * (pyeval_releaselock)
#? * (pyeval_acquirethread <tstate>)
#? * (pyeval_releasethread <tstate>)
#? * (pyeval_reinitthreads)
#? * (_pyeval_sliceindex <o1> <om>)

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

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

(de PyEval_SetProfile ( f  om )
    ((-gptr-) f)                ;; Py_tracefunc (function pointer) -> gptr
    ((-gptr-"PyObject *") om)   
    #{  PyEval_SetProfile( $f   ,$om );  #} 
    ())

(de PyEval_SetTrace ( f  om )
    ((-gptr-) f)     ;; Py_tracefunc (function pointer) -> gptr
    ((-gptr-"PyObject *") om)   
    #{  PyEval_SetTrace( $f   ,$om );  #} 
    ())

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

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

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

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

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

(de PyEval_GetRestricted ()
    (int  #{  PyEval_GetRestricted(  )  #} ))

(de PyEval_MergeCompilerFlags ( cf )
    ((-gptr-"PyCompilerFlags *") cf)   
    (int  #{  PyEval_MergeCompilerFlags( $cf )  #} ))

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

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

(de PyEval_SaveThread ()
    (gptr  #{  PyEval_SaveThread(  )  #} ))   ;; PyThreadState * -> gptr

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

(de PyEval_InitThreads ()
    #{ PyEval_InitThreads( );  #} 
    ())

(de PyEval_AcquireLock ()
    #{ PyEval_AcquireLock(  );  #} 
    ())

(de PyEval_ReleaseLock ()
    #{ PyEval_ReleaseLock(  );  #} 
    ())

(de PyEval_AcquireThread ( tstate )
    ((-gptr-"PyThreadState *") tstate)   
    #{  PyEval_AcquireThread( $tstate );  #} 
    ())

(de PyEval_ReleaseThread ( tstate )
    ((-gptr-"PyThreadState *") tstate)   
    #{  PyEval_ReleaseThread( $tstate );  #} 
    ())

(de PyEval_ReInitThreads ()
    #{ PyEval_ReInitThreads(  );  #} 
    ())

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

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

(dhc-make () 
  dummy_pyeval
  pyeval_callobjectwithkeywords
  pyeval_setprofile
  pyeval_settrace
  pyeval_getbuiltins
  pyeval_getglobals
  pyeval_getlocals
;;  pyeval_getowner
  pyeval_getframe
  pyeval_getrestricted
  pyeval_mergecompilerflags
  pyeval_getfuncname
  pyeval_getfuncdesc
  pyeval_savethread
  pyeval_restorethread
  pyeval_initthreads
  pyeval_acquirelock
  pyeval_releaselock
  pyeval_acquirethread
  pyeval_releasethread
  pyeval_reinitthreads
  _pyeval_sliceindex
)
