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


#? *** pylist

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

#? * (dummy_pylist)
#? * (pylist_new <size>)
#? * (pylist_size <om>)
#? * (pylist_getitem <o1> <im>)
#? * (pylist_setitem <o1> <s> <om>)
#? * (pylist_insert <o1> <s> <om>)
#? * (pylist_append <o1> <om>)
#? * (pylist_getslice <o1> <s> <im>)
#? * (pylist_setslice <o1> <s> <p> <om>)
#? * (pylist_sort <om>)
#? * (pylist_reverse <om>)
#? * (pylist_astuple <om>)

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

(de PyList_New ( size )
    ((-int-) size)   
    (gptr  #{  PyList_New( $size )  #} ))        ;; PyObject * -> gptr

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

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

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

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

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

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

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

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

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

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


()
;; ********************************************************

(dhc-make () 
  dummy_pylist
  pylist_new
  pylist_size
  pylist_getitem
  pylist_setitem
  pylist_insert
  pylist_append
  pylist_getslice
  pylist_setslice
  pylist_sort
  pylist_reverse
  pylist_astuple
)
