| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This module contains miscellaneous utilities useful in general SIOD and Festival programming.
Macros and functions mostly available in Lisp dialects:
when condition body-form ...
If and only if condition is true, evaluate body-forms.
unless condition body-form ...
If and only if condition is false, evaluate body-forms.
prog1 form ...
Evaluate all forms and return the return value of the first one.
let* bindings body-form ...
The same as let except that variable bindings are applied
sequentially rather than in parallel.
unwind-protect* protected-form cleanup-form ...
Evaluate protected-form, and after it is finished, whether successfully or with errors, evaluate all cleanup-forms. If protected-form was evaluated successfully, return its return value.
Unlike Festival's unwind-protect, unwind-protect*
accepts multiple cleanup-forms and evaluates them even when
protected-form doesn't signal an error.
first list
second list
third list
fourth list
Return first, second, third or fourth element of list, respectively.
butlast list
Return the list without its last element. If list is empty, return an empty list.
min x y
Return minimum of the two numeric values x and y.
max x y
Return maximum of the two numeric values x and y.
abs x
Return absolute value of x.
remove-if test list
Return list with elements, for which the test call returns
non-nil, removed. The order of list elements is preserved.
test must be a function of a single argument.
identity object
Return object.
complement function
Return a function that is equivalent to function except that it returns the opposite truth value to the return value of function.
apply* function arglist
The same as apply, except that it also works if function
is given as a string.
dolist (var items) body-form ...
Loop over items and perform body-forms over each of them, binding it to the variable var (unevaluated).
add-hook hook-variable hook-function to-end?
Add hook-function to hook-variable if it is not already present there. hook-variable must be a variable containing a list. If to-end? is true, add hook-function to the end of the list contained in hook-variable, otherwise add it to the beginning.
assoc-set list key value
Add the key-value pair to the association list and
return the resulting list. Contingent previously list entries
stored under key are removed from the resulting list.
avalue-get key alist
Find the first alist element of the form
(key* , where key* is
value)string-equal to key, and return value.
avalue-set! key alist value
Destructively set the value* of the first alist element of
the form (key* to value. Return
alist.
value*)
avg . args
Return average value of args.
dirname path
Return the directory part of path.
make-temp-filename template
Return name of a (probably non-existent) temporary file.
template is a basename of the file, that is formatted with the
format function and must contain exactly one %s sequence
to be replaced with a variable part of the file name.
Actually, this function is somewhat limited by the available Festival
system interface. So it is not safe, the file may be created before
it is actually used or the function may fail with an error. But for
simple purposes the function should work fine and it shouldn't be
worse than the standard make_tmp_filename function.
with-temp-file filename body
Macro that binds newly generated temporary file name to a local variable filename and then performs body. The macro ensures the temporary file is deleted after finishing body in any way.
string-replace string from to
Replace all occurrences of from by to in string and return the result.
Festival specific utilities:
item.has_feat item feature
Return true if and only if item has feature set.
langvar symbol
Return language dependent value stored under symbol. First, the
variable named symbol.language, where language is the
language name as stored in the Language parameter is checked and
if it is unbound, symbol's value is returned.
current-voice-coding
Return character coding of the currently selected voice in Festival.
The coding is taken from the coding attribute of the voice
description, if it is undefined or nil, ISO 8859-1 coding is
assumed. The coding voice attribute is introduced by
festival-freebsoft-utils, it is not a standard Festival feature.
utt-relation-top-items utt relation
Return a list of top level items in relation in utt.
do-relation-items (var utterance relation) body-form ...
Loop over relation items of utterance, performing body-forms for each of them, binding it to the variable var. The macro arguments var and relation are not evaluated.
do-relation-top-items (var utterance relation) body-form ...
Similar to do-relation-items, but loops only over the
relation's top items.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Milan Zamazal on August, 11 2009 using texi2html 1.78.