;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; 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 "htk/htk-config")



#? *** htk_rec

;; dummy function that adds HTK C header files in C file
(eval `(de dummy_htk_rec () ,htk-cpheader-cmd ()))

#? * (dummy_htk_rec)
#? * (initrec)
#? * (initpsetinfo <hset>)
#? * (freepsetinfo <psi>)
#? * (initvrecinfo <psi> <ntoks> <models> <states>)
#? * (deletevrecinfo <vri>)
#? * (startrecognition <vri> <net> <scale> <wordpen> <pscale>)
#? * (processobservation <vri> <obs> <id>)
#? * (completerecognition <vri> <framedur> <heap>)
#? * (setpruninglevels <vri> <maxbeam> <genbeam> <wordbeam> <nbeam> <tmbeam>)
#? * (transcriptionfromlattice <heap> <lat> <n>)
#? * (formattranscription <trans> <framedur> <states> <models> <tristrip> <normscores> <killscores> <centretimes> <killtimes> <killwords> <killmodels>)
#? * (tracepath <file> <path>)

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


(de InitRec (  )
    #{ InitRec(  );  #} 
    ()
)


(de InitPSetInfo (  hset )
    ((-gptr- "HMMSet *") hset)  
    (gptr #{ InitPSetInfo(  $hset  )  #} )            ;; PSetInfo *   -> gptr
)


(de FreePSetInfo (  psi )
    ((-gptr- "PSetInfo *") psi)  
    #{ FreePSetInfo(  $psi  );  #} 
    ()
)


(de InitVRecInfo (  psi  ntoks  models  states )
    ((-gptr- "PSetInfo *") psi) 
    ((-int-) ntoks) 
    ((-int-) models) 
    ((-int-) states)  
    (gptr #{ InitVRecInfo(  $psi   ,$ntoks   ,$models   ,$states  )  #} )            ;; VRecInfo *   -> gptr
)


(de DeleteVRecInfo (  vri )
    ((-gptr- "VRecInfo *") vri)  
    #{ DeleteVRecInfo(  $vri  );  #} 
    ()
)


(de StartRecognition (  vri  net  scale  wordpen  pscale )
    ((-gptr- "VRecInfo *") vri) 
    ((-gptr- "Network *") net) 
    ((-float-) scale) 
    ((-float-) wordpen) 
    ((-float-) pscale)  
    #{ StartRecognition(  $vri   ,$net   ,$scale   ,$wordpen   ,$pscale  );  #} 
    ()
)


(de ProcessObservation (  vri  obs  id )
    ((-gptr- "VRecInfo *") vri) 
    ((-gptr- "Observation *") obs) 
    ((-int-) id)  
    #{ ProcessObservation(  $vri   ,$obs   ,$id  );  #} 
    ()
)


(de CompleteRecognition (  vri  framedur  heap )
    ((-gptr- "VRecInfo *") vri) 
    ((-double-) framedur) 
    ((-gptr- "MemHeap *") heap)  
    (gptr #{ CompleteRecognition(  $vri   ,$framedur   ,$heap  )  #} )            ;; Lattice *   -> gptr
)


(de SetPruningLevels (  vri  maxbeam  genbeam  wordbeam  nbeam  tmbeam )
    ((-gptr- "VRecInfo *") vri) 
    ((-int-) maxbeam) 
    ((-float-) genbeam) 
    ((-float-) wordbeam) 
    ((-float-) nbeam) 
    ((-float-) tmbeam)  
    #{ SetPruningLevels(  $vri   ,$maxbeam   ,$genbeam   ,$wordbeam   ,$nbeam   ,$tmbeam  );  #} 
    ()
)


(de TranscriptionFromLattice (  heap  lat  n )
    ((-gptr- "MemHeap *") heap) 
    ((-gptr- "Lattice *") lat) 
    ((-int-) n)  
    (gptr #{ TranscriptionFromLattice(  $heap   ,$lat   ,$n  )  #} )            ;; Transcription *   -> gptr
)


(de FormatTranscription (  trans  framedur  states  models  tristrip  normscores  killscores  centretimes  killtimes  killwords  killmodels )
    ((-gptr- "Transcription *") trans) 
    ((-double-) framedur) 
    ((-int-) states) 
    ((-int-) models) 
    ((-int-) tristrip) 
    ((-int-) normscores) 
    ((-int-) killscores) 
    ((-int-) centretimes) 
    ((-int-) killtimes) 
    ((-int-) killwords) 
    ((-int-) killmodels)  
    #{ FormatTranscription(  $trans   ,$framedur   ,$states   ,$models   ,$tristrip   ,$normscores   ,$killscores   ,$centretimes   ,$killtimes   ,$killwords   ,$killmodels  );  #} 
    ()
)


(de TracePath (  file  path )
    ((-gptr- "FILE *") file) 
    ((-gptr- "Path *") path)  
    #{ TracePath(  $file   ,$path  );  #} 
    ()
)

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

(dhc-make-with-libs () (list htk-libhtk)
  dummy_htk_rec
  initrec
  initpsetinfo
  freepsetinfo
  initvrecinfo
  deletevrecinfo
  startrecognition
  processobservation
  completerecognition
  setpruninglevels
  transcriptionfromlattice
  formattranscription
  tracepath
)
