home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Multimed / Multimed.zip / fest-141.zip / festival / lib / cstr.scm < prev    next >
Lisp/Scheme  |  1999-12-23  |  5KB  |  122 lines

  1.  
  2.  
  3.  
  4.  
  5.  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  ;;; DO NOT EDIT THIS FILE ON PAIN OF MORE PAIN.
  7.  ;;; 
  8.  ;;; The master copy of this file is in ../../speech_tools/lib/siod/cstr.scm
  9.  ;;; and is copied here at build time.
  10.  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  24. ;;;                                                                       ;;
  25. ;;;                Centre for Speech Technology Research                  ;;
  26. ;;;                     University of Edinburgh, UK                       ;;
  27. ;;;                       Copyright (c) 1996,1997                         ;;
  28. ;;;                        All Rights Reserved.                           ;;
  29. ;;;                                                                       ;;
  30. ;;;  Permission is hereby granted, free of charge, to use and distribute  ;;
  31. ;;;  this software and its documentation without restriction, including   ;;
  32. ;;;  without limitation the rights to use, copy, modify, merge, publish,  ;;
  33. ;;;  distribute, sublicense, and/or sell copies of this work, and to      ;;
  34. ;;;  permit persons to whom this work is furnished to do so, subject to   ;;
  35. ;;;  the following conditions:                                            ;;
  36. ;;;   1. The code must retain the above copyright notice, this list of    ;;
  37. ;;;      conditions and the following disclaimer.                         ;;
  38. ;;;   2. Any modifications must be clearly marked as such.                ;;
  39. ;;;   3. Original authors' names are not deleted.                         ;;
  40. ;;;   4. The authors' names are not used to endorse or promote products   ;;
  41. ;;;      derived from this software without specific prior written        ;;
  42. ;;;      permission.                                                      ;;
  43. ;;;                                                                       ;;
  44. ;;;  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        ;;
  45. ;;;  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ;;
  46. ;;;  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ;;
  47. ;;;  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     ;;
  48. ;;;  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ;;
  49. ;;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ;;
  50. ;;;  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ;;
  51. ;;;  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ;;
  52. ;;;  THIS SOFTWARE.                                                       ;;
  53. ;;;                                                                       ;;
  54. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  55. ;;;
  56. ;;; CSTR siod extensions.
  57.  
  58. ;(defvar Parameter nil
  59. ;  "Parameter
  60. ;  An assoc-list of parameters and values for various parts of the speech
  61. ;  synthesis system.  This is used by the functions Parameter.set 
  62. ;  Parameter.def and Parameter.get as well as internal C++ functions.")
  63.  
  64. (defvar Param (feats.make)
  65.   "Param
  66.   A feature set for arbitrary parameters for modules.")
  67.  
  68. (define (Param.set name val)
  69. "(Param.set NAME VAL)
  70.   Set parameter NAME to VAL (deleting any previous setting)"
  71.   (feats.set Param name val))
  72.  
  73. (define (Parameter.set name val)
  74. "(Parameter.set NAME VAL)
  75.   Set parameter NAME to VAL (deleting any previous setting).  This is
  76.   an old function and you should use Param.set instead."
  77.   (Param.set name val)
  78.   val
  79.   )
  80.  
  81. (define (Parameter.def name val)
  82. "(Parameter.def NAME VAL)
  83.   Set parameter NAME to VAL if not already set.  This is an OLD function
  84.   you shold use Param.def instead."
  85.    (Param.def name val)
  86.   )
  87.  
  88. (define (Param.def name val)
  89. "(Param.def NAME VAL)
  90.   Set parameter NAME to VAL if not already set"
  91.    (if (not (feats.present Param name))
  92.        (feats.set Param name val)))
  93.  
  94. (define (Parameter.get name)
  95. "(Parameter.get NAME)
  96.   Get parameter NAME's value (nil if unset).  This is an OLD function
  97.   and may not exist in later versions (or change functionality).  This
  98.   function (unlike Param.get) may return sylbols (rather than strings
  99.   if the val doesn't contain whitespace (to allow older functions to 
  100.   still work."
  101.    (let ((val (Param.get name)))
  102.      (if (and (eq? 'string (typeof val))
  103.           (not (string-matches val ".*[ \t\r\n].*")))
  104.      (intern val)
  105.      val))
  106.   )
  107.  
  108. (define (Param.get name)
  109. "(Param.get NAME)
  110.   Get parameter NAME's value (nil if unset)"
  111.   (feats.get Param name))
  112.  
  113. (define (get_param name params default)
  114.   "(get_param name params default)
  115. Get named parameters in params returning default if its not present."
  116.   (let ((pair (assoc name params)))
  117.     (if pair
  118.     (car (cdr pair))
  119.     default)))
  120.  
  121. (provide 'cstr)
  122.