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


#? *** pystring

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

#? * (dummy_pystring)
#? * (pystring_fromstringandsize <o1> <im>)
#? * (pystring_fromstring <om>)
#? * (pystring_size <om>)
#? * (pystring_asstring <om>)
#? * (pystring_concat <o1> <om>)
#? * (pystring_concatanddel <o1> <om>)
#? * (_pystring_resize <o1> <im>)
#? * (_pystring_eq <o1> <om>)
#? * (pystring_format <o1> <om>)
#? * (_pystring_formatlong <o1> <s> <p> <m> <o2> <om>)
#? * (pystring_interninplace <om>)
#? * (pystring_internfromstring <om>)
#? * (_pystring_join <sep> <x>)
#? * (pystring_decode <s> <size> <encoding> <errors>)
#? * (pystring_encode <s> <size> <encoding> <errors>)
#? * (pystring_asencodedobject <str> <encoding> <errors>)
#? * (pystring_asencodedstring <str> <encoding> <errors>)
#? * (pystring_asdecodedobject <str> <encoding> <errors>)
#? * (pystring_asdecodedstring <str> <encoding> <errors>)
#? * (pystring_asstringandsize <obj> <s> <len>)
#? * (pystring_fini)

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

(de PyString_FromStringAndSize ( o1  im )
    ((-str-) o1)  
    ((-int-) im)   
    (gptr  #{  PyString_FromStringAndSize((const char *)$o1->data   ,$im )  #} ))        ;; PyObject * -> gptr

(de PyString_FromString ( om )
    ((-str-) om)   
    (gptr  #{  PyString_FromString( (const char *)$om->data )  #} ))        ;; PyObject * -> gptr

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

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

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

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

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

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

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

(de _PyString_FormatLong ( o1  s  p  m  o2  om )
    ((-gptr-"PyObject*") o1)  
    ((-int-) s)  
    ((-int-) p)  
    ((-int-) m)  
    ((-gptr-"char**") o2)  
    ((-gptr-"int*") om)   
    (gptr  #{ _PyString_FormatLong( $o1   ,$s   ,$p   ,$m   ,$o2   ,$om )  #} ))        ;; PyObject * -> gptr

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

(de PyString_InternFromString ( om )
    ((-str-) om)   
    (gptr  #{  PyString_InternFromString( (const char *)$om->data )  #} ))        ;; PyObject * -> gptr

(de _PyString_Join ( sep  x )
    ((-gptr-"PyObject *") sep)  
    ((-gptr-"PyObject *") x)   
    (gptr  #{ _PyString_Join( $sep   ,$x )  #} ))        ;; PyObject * -> gptr

(de PyString_Decode ( s  size  encoding  errors )
    ((-str-) s)  
    ((-int-) size)  
    ((-str-) encoding)  
    ((-str-) errors)   
    (gptr  #{  PyString_Decode( (const char *)$s->data ,$size   ,(const char *)$encoding->data ,(const char *)$errors->data )  #} ))   ;; PyObject * -> gptr

(de PyString_Encode (s  size  encoding  errors )
    ((-str-) s)  
    ((-int-) size)  
    ((-str-) encoding)  
    ((-str-) errors)   
    (gptr  #{  PyString_Encode( (const char *)$s->data ,$size ,(const char *)$encoding->data ,(const char *)$errors->data )  #} ))   ;; PyObject * -> gptr

(de PyString_AsEncodedObject (str  encoding  errors )
    ((-gptr-"PyObject *") str)  
    ((-str-) encoding)  
    ((-str-) errors)   
    (gptr  #{  PyString_AsEncodedObject( $str ,(const char *)$encoding->data ,(const char *)$errors->data )  #} ))   ;; PyObject * -> gptr

(de PyString_AsEncodedString (str  encoding  errors )
    ((-gptr-"PyObject *") str)  
    ((-str-) encoding)  
    ((-str-) errors)   
    (gptr  #{  PyString_AsEncodedString( $str ,(const char *)$encoding->data ,(const char *)$errors->data )  #} ))   ;; PyObject * -> gptr

(de PyString_AsDecodedObject (str  encoding  errors )
    ((-gptr-"PyObject *") str)  
    ((-str-) encoding)  
    ((-str-) errors)   
    (gptr  #{  PyString_AsDecodedObject( $str ,(const char *)$encoding->data ,(const char *)$errors->data )  #} ))   ;; PyObject * -> gptr

(de PyString_AsDecodedString (str  encoding  errors )
    ((-gptr-"PyObject *") str)  
    ((-str-) encoding)  
    ((-str-) errors)   
    (gptr  #{  PyString_AsDecodedString( $str ,(const char *)$encoding->data ,(const char *)$errors->data )  #} ))   ;; PyObject * -> gptr

(de PyString_AsStringAndSize (obj  s  len )
    ((-gptr-"PyObject *") obj)  
    ((-gptr-"char **") s)  
    ((-gptr-"int *") len)   
    (int  #{  PyString_AsStringAndSize(   $obj   ,$s   ,$len )  #} ))

(de PyString_Fini ()
    #{ PyString_Fini(  );  #} 
    ())


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

(dhc-make () 
  dummy_pystring
  pystring_fromstringandsize
  pystring_fromstring
  pystring_size
  pystring_asstring
  pystring_concat
  pystring_concatanddel
  _pystring_resize
  _pystring_eq
  pystring_format
  _pystring_formatlong
  pystring_interninplace
  pystring_internfromstring
  _pystring_join
  pystring_decode
  pystring_encode
  pystring_asencodedobject
  pystring_asencodedstring
  pystring_asdecodedobject
  pystring_asdecodedstring
  pystring_asstringandsize
  pystring_fini
)
