Index: festival/doc/Makefile
--- festival/doc/Makefile.orig	2001-04-04 13:55:21 +0200
+++ festival/doc/Makefile	2008-03-21 17:18:13 +0100
@@ -56,7 +56,8 @@
 	     banner.inc $(DOCXXIMAGES)
 
 MANPAGES = festival.head festival.tail \
-           festival_client.head festival_client.tail
+           festival_client.head festival_client.tail \
+                  text2wave.head text2wave.tail
 
 #SGMLFILES = festival.sgml \
 #	introductory.sgml basics.sgml core.sgml advanced.sgml programming.sgml
@@ -64,7 +65,7 @@
 FILES=Makefile $(MANPAGES) festival.texi $(SGMLFILES) refcard.tex  $(DOCXXFILES)
 LOCAL_CLEAN = *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr
 
-ALL = festival.1 festival_client.1
+ALL = festival.1 festival_client.1 text2wave.1
 
 include $(TOP)/config/common_make_rules
 include $(EST)/config/rules/doc.mak
Index: festival/doc/text2wave.head
--- /dev/null	2008-03-21 17:19:06 +0100
+++ festival/doc/text2wave.head	2008-03-21 17:18:13 +0100
@@ -0,0 +1,19 @@
+.TH  TEXT2WAVE 1 "6th Apr 1998"
+.SH NAME
+text2wave \- convert text to .wav files
+.SH SYNOPSIS
+.B text2wave
+.I [options]
+<
+.I text
+>
+.I sound.wav
+
+
+.SH DESCRIPTION
+
+This script is part of the festival text-to-speech system.
+It is a wrapper for festival's Scheme code for easy usage in TTS
+scripts.
+
+.SH OPTIONS
Index: festival/doc/text2wave.options
--- /dev/null	2008-03-21 17:19:06 +0100
+++ festival/doc/text2wave.options	2008-03-21 17:18:13 +0100
@@ -0,0 +1,47 @@
+.\"
+.\".SH OPTIONS
+.\"  -mode <string>  Explicit tts mode.
+.\"  -o ofile        File to save waveform (default is stdout).
+.\"  -otype <string> Output waveform type: ulaw, snd, aiff, riff, nist etc.
+.\"                  (default is riff)
+.\"  -F <int>        Output frequency.
+.\"  -scale <float>  Volume factor
+.\"  -eval <string>  File or lisp s-expression to be evaluated before
+.\"                  synthesis.
+
+.TP
+.B \-mode
+.I string
+.br
+Explicit tts mode.
+.TP
+.B \-o
+.I ofile
+.br
+File to save waveform to.
+.br
+The default is
+.B stdout.
+.TP
+.B \-otype
+.I string
+.br
+Output waveform type: ulaw, snd, aiff, riff, nist etc.
+.br
+The default is
+.B riff.
+.TP
+.B \-f
+.I integer
+.br
+Output frequency.
+.TP
+.B \-scale
+.I float
+.br
+Volume factor.
+.TP
+.B \-eval
+.I "string"
+.br
+File or lisp s-expression to be evaluated before synthesis.
Index: festival/doc/text2wave.tail
--- /dev/null	2008-03-21 17:19:06 +0100
+++ festival/doc/text2wave.tail	2008-03-21 17:18:13 +0100
@@ -0,0 +1,26 @@
+
+.SH BUGS
+More than you can imagine.
+
+A manual with much detail (though not complete) is available
+in distributed as part of the system and is also accessible at
+.br
+http://www.cstr.ed.ac.uk/projects/festival/manual/
+
+Although we cannot guarantee the time required to fix bugs, we
+would appreciated it if they were reported to
+.br
+festival-bug@cstr.ed.ac.uk
+
+.SH AUTHOR
+Alan W Black, Richard Caley and Paul Taylor
+.br
+(C) Centre for Speech Technology Research, 1996-1998
+.br
+University of Edinburgh
+.br
+80 South Bridge
+.br
+Edinburgh EH1 1HN
+.br
+http://www.cstr.ed.ac.uk/projects/festival.html
Index: festival/lib/init.scm
--- festival/lib/init.scm.orig	2004-07-16 01:03:04 +0200
+++ festival/lib/init.scm	2008-03-21 17:18:13 +0100
@@ -55,6 +55,10 @@
 (if (probe_file (path-append libdir "sitevars.scm"))
     (load (path-append libdir "sitevars.scm")))
 
+;;;  OpenPKG configuration hook 1
+(if (probe_file "@l_prefix@/etc/festival/festival-vars.scm")
+    (load "@l_prefix@/etc/festival/festival-vars.scm"))
+
 ;;; CSTR siod extensions
 (require 'cstr)
 
@@ -138,6 +142,10 @@
 (if (probe_file (path-append libdir "siteinit.scm"))
     (load (path-append libdir "siteinit.scm")))
 
+;;;  OpenPKG configuration hook 2
+(if (probe_file "@l_prefix@/etc/festival/festival-init.scm")
+    (load "@l_prefix@/etc/festival/festival-init.scm"))
+
 ;;;  User initialization, if a user has a personal customization
 ;;;  file loaded it
 (if (probe_file (path-append home-directory ".siodrc"))
Index: festival/lib/multisyn/multisyn_pauses.scm
--- festival/lib/multisyn/multisyn_pauses.scm.orig	2004-06-21 16:19:30 +0200
+++ festival/lib/multisyn/multisyn_pauses.scm	2008-03-21 17:18:13 +0100
@@ -85,8 +85,8 @@
 (let ((silence (car (cadr (car (PhoneSet.description '(silences))))))
       (seg (item.relation (find_last_seg word) 'Segment))
       pause_item)
-  (format t "  inserting pause after: %s.\n" (item.name seg))
-  (format t "  Inserting pause\n")
+;  (format t "  inserting pause after: %s.\n" (item.name seg))
+;  (format t "  Inserting pause\n")
 ; if next seg is not silence insert one.
   (if (or (not (item.next seg))
 	  (not (string-equal (item.name (item.next seg)) silence)))
Index: festival/lib/tts.scm
--- festival/lib/tts.scm.orig	2005-05-09 16:12:06 +0200
+++ festival/lib/tts.scm	2008-03-21 17:18:13 +0100
@@ -89,7 +89,7 @@
 
 ;;;  The program used to parse stml files
 ;;;  Needs version 1.0 to allow -D option to work
-(defvar sgml_parse_progname "nsgmls-1.0"
+(defvar sgml_parse_progname "@l_prefix@/bin/onsgmls"
   "sgml_parse_progname
 The name of the program to use to parse SGML files.  Typically this is
 nsgml-1.0 from the sp SGML package. [see XML/SGML requirements]")
Index: festival/lib/voices.scm
--- festival/lib/voices.scm.orig	2005-05-02 16:20:37 +0200
+++ festival/lib/voices.scm	2008-03-21 17:18:13 +0100
@@ -42,7 +42,7 @@
 ;; The path to search for voices is created from the load-path with
 ;; an extra list of directories appended.
 
-(defvar system-voice-path '( )
+(defvar system-voice-path '("@l_prefix@/lib/festival/voices")
   "system-voice-path
    Additional directory not near the load path where voices can be
    found, this can be redefined in lib/sitevars.scm if desired.")
Index: festival/src/arch/festival/audspio.cc
--- festival/src/arch/festival/audspio.cc.orig	2004-09-30 15:04:17 +0200
+++ festival/src/arch/festival/audspio.cc	2008-03-21 17:18:13 +0100
@@ -108,7 +108,7 @@
 	{
 	    audio = ft_get_param("Audio_Method");
 	    command = ft_get_param("Audio_Command");
-	    audfds = pipe_open("audsp");
+	    audfds = pipe_open("festival_audsp");
 	    if (audio != NIL)
 		audsp_send(EST_String("method ")+get_c_string(audio));
 	    if (command != NIL)
Index: speech_tools/config/config.in
--- speech_tools/config/config.in.orig	2006-07-08 20:06:18 +0200
+++ speech_tools/config/config.in	2008-03-21 17:18:13 +0100
@@ -83,7 +83,7 @@
 # INCLUDE_MODULES += ESD_AUDIO
 
 ## Native audio for your platform (sun, linux, freebsd, irix, macosx, windows)
-INCLUDE_MODULES += NATIVE_AUDIO
+# INCLUDE_MODULES += NATIVE_AUDIO
 
 ## Special code to run Windows MPLAYER
 # INCLUDE_MODULES += MPLAYER_AUDIO
Index: speech_tools/config/rules/install.mak
--- speech_tools/config/rules/install.mak.orig	2001-04-04 13:55:32 +0200
+++ speech_tools/config/rules/install.mak	2008-03-21 17:18:13 +0100
@@ -39,7 +39,7 @@
 
 
 
-PROJECT_HOME_PATH := $(shell mkdir -p $($(PROJECT_PREFIX)_HOME); cd $($(PROJECT_PREFIX)_HOME); pwd)
+PROJECT_HOME_PATH := $($(PROJECT_PREFIX)_HOME)
 
 PROJECT_TOP_PATH := $(shell (cd $(TOP); pwd))
 
Index: speech_tools/config/system.sh
--- speech_tools/config/system.sh.orig	2002-12-27 19:39:26 +0100
+++ speech_tools/config/system.sh	2008-03-21 17:18:13 +0100
@@ -94,6 +94,7 @@
     elif [ "$OSTYPE" = "Darwin" ]; then
         OSREV=
     else
+	MACHINETYPE=unknown
 	OSTYPE=unknown
 	OSREV=
     fi
Index: speech_tools/grammar/ngram/EST_Ngrammar.cc
--- speech_tools/grammar/ngram/EST_Ngrammar.cc.orig	2004-09-30 14:53:36 +0200
+++ speech_tools/grammar/ngram/EST_Ngrammar.cc	2008-03-21 17:18:13 +0100
@@ -184,7 +184,7 @@
 					  const double count)
 {
 
-//    int i;
+//    intptr_t i;
 //    cerr << "accumulate level " << p_level << " : ";
 //    for(i=0;i<words.n();i++)
 //    {
@@ -306,7 +306,7 @@
     // not right - just print out, then recurse through children
     // change to use 'backoff_traverse'
     
-    int k;
+    intptr_t k;
     double freq;
     EST_String name;
     for (k=p_pdf.item_start();
@@ -373,7 +373,7 @@
 {
 
     // recursively delete this state and all its children
-    int k;
+    intptr_t k;
     double freq;
     EST_String name;
     for (k=p_pdf.item_start();
@@ -456,7 +456,7 @@
 
 void EST_BackoffNgrammarState::frequency_of_frequencies(EST_DVector &ff)
 {
-    int k,max=ff.n();
+    intptr_t k; int max=ff.n();
     double freq;
     EST_String name;
     for (k=p_pdf.item_start();
@@ -915,7 +915,7 @@
 {
     
     /*
-       int i;
+       intptr_t i;
        for(i=0;i<words.n();i++)
        {
        cerr << vocab_pdf.item_name(words(i));
@@ -1585,7 +1585,7 @@
     // remove any branches with zero frequency count
     
     // find children of this state with zero freq and zap them
-    int k;
+    intptr_t k;
     double freq;
     EST_String name;
     for (k=start_state->pdf_const().item_start();
@@ -2324,7 +2324,7 @@
 	backoff_representation->print_freqs(os,p_order);
     else
     {
-	int i,j,k;
+	int i,j; intptr_t k;
 	EST_IVector window(p_order-1);
 	
 	for (i=0; i < p_num_states; i++)
@@ -2665,7 +2665,7 @@
     function(start_state,params);
     
     // and recurse down the tree
-    int k;
+    intptr_t k;
     double freq;
     EST_String name;
     for (k=start_state->pdf_const().item_start();
@@ -2696,7 +2696,7 @@
     {
 	// and recurse down the tree if we haven't
 	// reached the level yet
-	int k;
+	intptr_t k;
 	double freq;
 	EST_String name;
 	
Index: speech_tools/grammar/ngram/EST_PST.cc
--- speech_tools/grammar/ngram/EST_PST.cc.orig	2004-09-30 14:53:36 +0200
+++ speech_tools/grammar/ngram/EST_PST.cc	2008-03-21 17:18:13 +0100
@@ -71,7 +71,7 @@
 	// Base -- print from pd 
 	EST_String s;
 	double freq;
-	for (int i = pd.item_start(); 
+	for (intptr_t i = pd.item_start(); 
 	     !pd.item_end(i); 
 	     i=pd.item_next(i))
 	{
@@ -98,7 +98,7 @@
 	EST_String s;
 	double prob;
 	os << get_path() << " :";
-	for (int i = pd.item_start(); !pd.item_end(i) ; i=pd.item_next(i))
+	for (intptr_t i = pd.item_start(); !pd.item_end(i) ; i=pd.item_next(i))
 	{
 	    pd.item_prob(i,s,prob);
 	    os << " " << s << " " << prob;
Index: speech_tools/grammar/ngram/freqsmooth.cc
--- speech_tools/grammar/ngram/freqsmooth.cc.orig	2004-09-30 14:53:36 +0200
+++ speech_tools/grammar/ngram/freqsmooth.cc	2008-03-21 17:18:13 +0100
@@ -74,7 +74,7 @@
 				 EST_Ngrammar &ngram)
 {
     // Build all the backoff grammars back to uni-grams
-    int i,j,k,l;
+    int i,j,l; intptr_t k;
 
     for (i=0; i < ngram.order()-1; i++)
 	backoff_ngrams[i].init(i+1,EST_Ngrammar::dense,
@@ -110,7 +110,7 @@
 {
     // For all ngrams which are too infrequent, adjust their
     // frequencies based on their backoff probabilities
-    int i,j;
+    int i; intptr_t j;
     double occurs;
     double backoff_prob;
 
Index: speech_tools/grammar/ngram/ngrammar_aux.cc
--- speech_tools/grammar/ngram/ngrammar_aux.cc.orig	2004-09-30 14:53:36 +0200
+++ speech_tools/grammar/ngram/ngrammar_aux.cc	2008-03-21 17:18:13 +0100
@@ -117,7 +117,7 @@
 
 void make_f_of_f(EST_BackoffNgrammarState *s,void *params)
 {
-    int k;
+    intptr_t k;
     double freq;
     EST_String name;
 
@@ -138,7 +138,7 @@
 
 void get_max_f(EST_BackoffNgrammarState *s,void *params)
 {
-    int k;
+    intptr_t k;
     double freq;
     EST_String name;
 
@@ -158,7 +158,7 @@
 
 void map_f_of_f(EST_BackoffNgrammarState *s,void *params)
 {
-    int k;
+    intptr_t k;
     double freq;
     EST_String name;
 
@@ -184,7 +184,7 @@
 
 void zero_small_f(EST_BackoffNgrammarState *s,void *params)
 {
-    int k;
+    intptr_t k;
     double freq;
     EST_String name;
 
@@ -204,7 +204,7 @@
 
 void frequency_of_frequencies(EST_DVector &ff, EST_Ngrammar &n,int this_order)
 {
-  int i,k,size;
+  int i,size; intptr_t k;
   double max=0.0;
 
   // if ff has zero size, do complete frequency of frequencies
@@ -302,7 +302,7 @@
 
 void map_frequencies(EST_Ngrammar &n, const EST_DVector &map, const int this_order)
 {
-  int i,k;
+  int i; intptr_t k;
 
 
   switch(n.representation())
Index: speech_tools/grammar/ngram/ngrammar_io.cc
--- speech_tools/grammar/ngram/ngrammar_io.cc.orig	2004-09-30 14:53:36 +0200
+++ speech_tools/grammar/ngram/ngrammar_io.cc	2008-03-21 17:18:13 +0100
@@ -281,7 +281,7 @@
 load_ngram_cstr_bin(const EST_String filename, EST_Ngrammar &n)
 {
     EST_TokenStream ts;
-    int i,j,k,order;
+    int i,j,order; intptr_t k;
     int num_entries;
     double approx_num_samples = 0.0;
     long freq_data_start, freq_data_end;
@@ -407,7 +407,7 @@
 save_ngram_htk_ascii_sub(const EST_String &word, ostream *ost, 
 			 EST_Ngrammar &n, double floor)
 {
-    int k;
+    intptr_t k;
     EST_String name;
     double freq;
     EST_StrVector this_ngram(2); // assumes bigram
@@ -734,7 +734,7 @@
     // awb's format
     (void)trace;
     ostream *ost;
-    int i,k;
+    int i; intptr_t k;
     
     if (filename == "-")
 	ost = &cout;
@@ -831,7 +831,7 @@
     if (n.representation() == EST_Ngrammar::sparse)
 	return misc_write_error;
     
-    int i,k;
+    int i; intptr_t k;
     FILE *ofd;
     double lfreq = -1;
     double count = -1;
Index: speech_tools/grammar/wfst/wfst_train.cc
--- speech_tools/grammar/wfst/wfst_train.cc.orig	2005-07-27 00:37:36 +0200
+++ speech_tools/grammar/wfst/wfst_train.cc	2008-03-21 17:18:13 +0100
@@ -315,7 +315,7 @@
     LISP *ssplits;
     gc_protect(&splits);
     EST_String sname;
-    int b,best_b,i;
+    int b,best_b; intptr_t i;
     int num_pdfs;
     double best_score, score, sfreq;
 
@@ -390,7 +390,7 @@
     // Find score of (a+b) vs (all-(a+b))
     EST_DiscreteProbDistribution ab(a);
     EST_DiscreteProbDistribution all_but_ab(all);
-    int i;
+    intptr_t i;
     EST_String sname;
     double sfreq, score;
     for (i=b.item_start(); !b.item_end(i);
@@ -522,7 +522,7 @@
     EST_DiscreteProbDistribution pdf_split(&wfst.in_symbols());
     EST_DiscreteProbDistribution pdf_remain(&wfst.in_symbols());
     int in, tostate, id;
-    int i;
+    intptr_t i;
     double sfreq;
     EST_String sname;
 
Index: speech_tools/include/EST_simplestats.h
--- speech_tools/include/EST_simplestats.h.orig	2004-04-30 18:56:49 +0200
+++ speech_tools/include/EST_simplestats.h	2008-03-21 17:18:13 +0100
@@ -194,7 +194,7 @@
     for example
     \begin{verbatim}
        EST_DiscreteProbistribution pdf;
-       for (int i=pdf.item_start(); i < pdf.item_end(); i=pdf.item_next(i))
+       for (intptr_t i=pdf.item_start(); i < pdf.item_end(); i=pdf.item_next(i))
        {
           EST_String name;
           double prob;
@@ -265,17 +265,17 @@
     /// 
     double frequency(const int i) const; 
     /// Used for iterating through members of the distribution
-    int item_start() const;
+    intptr_t item_start() const;
     /// Used for iterating through members of the distribution
-    int item_next(int idx) const;
+    intptr_t item_next(intptr_t idx) const;
     /// Used for iterating through members of the distribution
-    int item_end(int idx) const;
+    int item_end(intptr_t idx) const;
     /// During iteration returns name given index 
-    const EST_String &item_name(int idx) const;
+    const EST_String &item_name(intptr_t idx) const;
     /// During iteration returns name and frequency given index  
-    void item_freq(int idx,EST_String &s,double &freq) const;
+    void item_freq(intptr_t idx,EST_String &s,double &freq) const;
     /// During iteration returns name and probability given index
-    void item_prob(int idx,EST_String &s,double &prob) const;
+    void item_prob(intptr_t idx,EST_String &s,double &prob) const;
 
     /// Returns discrete vocabulary of distribution
     inline const EST_Discrete *const get_discrete() const { return discrete; };
Index: speech_tools/include/EST_unix.h
--- speech_tools/include/EST_unix.h.orig	2004-04-30 18:56:49 +0200
+++ speech_tools/include/EST_unix.h	2008-03-21 17:18:13 +0100
@@ -53,6 +53,7 @@
 #   include <sys/wait.h>
 #   include <sys/resource.h>
 #   include <dirent.h>
+#   define unix 1
 #elif defined(SYSTEM_IS_WIN32)
 #   include <io.h>
 #   include "win32/EST_unix_win32.h"
Index: speech_tools/stats/EST_DProbDist.cc
--- speech_tools/stats/EST_DProbDist.cc.orig	2004-09-30 14:53:36 +0200
+++ speech_tools/stats/EST_DProbDist.cc	2008-03-21 17:18:13 +0100
@@ -305,15 +305,15 @@
 }
 
 //  For iterating through members of a probability distribution
-int EST_DiscreteProbDistribution::item_start(void) const
+intptr_t EST_DiscreteProbDistribution::item_start(void) const
 {
     if (type == tprob_discrete)
 	return 0;
     else
-	return (int)scounts.list.head();
+	return (intptr_t)scounts.list.head();
 }
 
-int EST_DiscreteProbDistribution::item_end(int idx) const
+int EST_DiscreteProbDistribution::item_end(intptr_t idx) const
 {
     if (type == tprob_discrete)
 	return (idx >= icounts.length());
@@ -321,15 +321,15 @@
 	return ((EST_Litem *)idx == 0);
 }
 
-int EST_DiscreteProbDistribution::item_next(int idx) const
+intptr_t EST_DiscreteProbDistribution::item_next(intptr_t idx) const
 {
     if (type == tprob_discrete)
 	return ++idx;
     else
-	return (int)next((EST_Litem *)idx);
+	return (intptr_t)next((EST_Litem *)idx);
 }
 
-const EST_String &EST_DiscreteProbDistribution::item_name(int idx) const
+const EST_String &EST_DiscreteProbDistribution::item_name(intptr_t idx) const
 {
     if (type == tprob_discrete)
 	return discrete->name(idx);
@@ -337,7 +337,7 @@
 	return scounts.list((EST_Litem *)idx).k;
 }
 
-void EST_DiscreteProbDistribution::item_freq(int idx,EST_String &s,double &freq) const
+void EST_DiscreteProbDistribution::item_freq(intptr_t idx,EST_String &s,double &freq) const
 {
     if (type == tprob_discrete)
     {
@@ -351,7 +351,7 @@
     }
 }
 
-void EST_DiscreteProbDistribution::item_prob(int idx,EST_String &s,double &prob) const
+void EST_DiscreteProbDistribution::item_prob(intptr_t idx,EST_String &s,double &prob) const
 {
     if (type == tprob_discrete)
     {
@@ -368,7 +368,7 @@
 ostream & operator<<(ostream &s, const EST_DiscreteProbDistribution &pd)
 {
     // Output best with probabilities
-    int i;
+    intptr_t i;
     double prob;
     double sum=0;
     EST_String name;
Index: speech_tools/stats/wagon/wagon_aux.cc
--- speech_tools/stats/wagon/wagon_aux.cc.orig	2006-08-20 19:02:39 +0200
+++ speech_tools/stats/wagon/wagon_aux.cc	2008-03-21 17:18:13 +0100
@@ -900,7 +900,7 @@
     }
     else if (imp.t == wnim_class)
     {
-	int i;
+	intptr_t i;
 	EST_String name;
 	double prob;
 
Index: speech_tools/testsuite/correct/matrix_regression.out
--- speech_tools/testsuite/correct/matrix_regression.out.orig	2001-04-04 13:55:32 +0200
+++ speech_tools/testsuite/correct/matrix_regression.out	2008-03-21 17:18:13 +0100
@@ -1,5 +1,3 @@
-EST_TVector<int> size = 20 bytes.
-EST_TMatrix<int> size = 28 bytes.
 Initial Matrix
 0	1	2	3	4	
 100	101	102	103	104	
Index: speech_tools/testsuite/matrix_regression.cc
--- speech_tools/testsuite/matrix_regression.cc.orig	2004-09-30 14:53:37 +0200
+++ speech_tools/testsuite/matrix_regression.cc	2008-03-21 17:18:13 +0100
@@ -54,9 +54,6 @@
 {
   EST_TMatrix<int> m(5,5);
 
-  cout << "EST_TVector<int> size = " << sizeof(EST_TVector<int>) << " bytes.\n";
-  cout << "EST_TMatrix<int> size = " << sizeof(EST_TMatrix<int>) << " bytes.\n";
-
   for(int i=0; i<m.num_rows(); i++)
     for(int j=0; j<m.num_columns(); j++)
       m.a(i,j) = i*100+j;
