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


#? *** pydict

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

#? * (dummy_pydict)
#? * (pydict_new)
#? * (pydict_getitem <mp> <key>)
#? * (pydict_setitem <mp> <key> <item>)
#? * (pydict_delitem <mp> <key>)
#? * (pydict_clear <mp>)
#? * (pydict_next <mp> <pos> <key> <value>)
#? * (pydict_keys <mp>)
#? * (pydict_values <mp>)
#? * (pydict_items <mp>)
#? * (pydict_size <mp>)
#? * (pydict_copy <mp>)
#? * (pydict_update <mp> <other>)
#? * (pydict_merge <mp> <other> <override>)
#? * (pydict_mergefromseq2 <d> <seq2> <override>)
#? * (pydict_getitemstring <dp> <key>)
#? * (pydict_setitemstring <dp> <key> <item>)
#? * (pydict_delitemstring <dp> <key>)

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


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

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

(de PyDict_SetItem ( mp  key  item )
    ((-gptr-"PyObject *") mp)  
    ((-gptr-"PyObject *") key)  
    ((-gptr-"PyObject *") item)   
    (int  #{  PyDict_SetItem( $mp   ,$key   ,$item )  #} ))

(de PyDict_DelItem ( mp  key )
    ((-gptr-"PyObject *") mp)  
    ((-gptr-"PyObject *") key)   
    (int  #{  PyDict_DelItem( $mp   ,$key )  #} ))

(de PyDict_Clear ( mp )
    ((-gptr-"PyObject *") mp)   
    #{  PyDict_Clear( $mp );  #} 
    ())

(de PyDict_Next ( mp  pos  key  value )
     ((-gptr-"PyObject *") mp)  
     ((-gptr-"int *") pos)  
     ((-gptr-"PyObject **") key)  
     ((-gptr-"PyObject **") value)   
     (int  #{  PyDict_Next ( $mp   ,$pos   ,$key   ,$value )  #} ))

(de PyDict_Keys ( mp )
    ((-gptr-"PyObject *") mp)   
    (gptr  #{  PyDict_Keys( $mp )  #} ))        ;; PyObject * -> gptr

(de PyDict_Values ( mp )
    ((-gptr-"PyObject *") mp)   
    (gptr  #{  PyDict_Values( $mp )  #} ))        ;; PyObject * -> gptr

(de PyDict_Items ( mp )
    ((-gptr-"PyObject *") mp)   
    (gptr  #{  PyDict_Items( $mp )  #} ))        ;; PyObject * -> gptr

(de PyDict_Size ( mp )
    ((-gptr-"PyObject *") mp)   
    (int  #{  PyDict_Size( $mp )  #} ))

(de PyDict_Copy ( mp )
    ((-gptr-"PyObject *") mp)   
    (gptr  #{  PyDict_Copy( $mp )  #} ))        ;; PyObject * -> gptr

(de PyDict_Update ( mp  other )
    ((-gptr-"PyObject *") mp)  
    ((-gptr-"PyObject *") other)   
    (int  #{  PyDict_Update( $mp   ,$other )  #} ))

(de PyDict_Merge ( mp  other  override )
    ((-gptr-"PyObject *") mp)  
    ((-gptr-"PyObject *") other)  
    ((-int-) override)   
    (int  #{  PyDict_Merge( $mp   ,$other   ,$override )  #} ))

(de PyDict_MergeFromSeq2 ( d  seq2  override )
    ((-gptr-"PyObject *") d)  
    ((-gptr-"PyObject *") seq2)  
    ((-int-) override)   
    (int  #{  PyDict_MergeFromSeq2( $d   ,$seq2   ,$override )  #} ))

(de PyDict_GetItemString ( dp  key )
    ((-gptr-"PyObject *") dp)  
    ((-str-) key)   
    (gptr  #{  PyDict_GetItemString( $dp   ,$key->data )  #} ))        ;; PyObject * -> gptr

(de PyDict_SetItemString ( dp  key  item )
    ((-gptr-"PyObject *") dp)  
    ((-str-) key)  
    ((-gptr-"PyObject *") item)   
    (int  #{  PyDict_SetItemString( $dp   ,$key->data   ,$item )  #} ))

(de PyDict_DelItemString ( dp  key )
    ((-gptr-"PyObject *") dp)  
    ((-str-) key)   
    (int  #{  PyDict_DelItemString( $dp   ,$key->data )  #} ))


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

(dhc-make () 
  dummy_pydict
  pydict_new
  pydict_getitem
  pydict_setitem
  pydict_delitem
  pydict_clear
  pydict_next
  pydict_keys
  pydict_values
  pydict_items
  pydict_size
  pydict_copy
  pydict_update
  pydict_merge
  pydict_mergefromseq2
  pydict_getitemstring
  pydict_setitemstring
  pydict_delitemstring
)
